Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Cannot generate valid RSS file

Unfortunately, using the RSS recipe provided in the Knowledgebase generates RSS that will not actually validate, since links in the .teaser to the main article (the teaser is used for the RSS description values) is not a fully qualified URL. Relative links are not allowed in RSS (even in 0.91) since the point of RSS files is to syndicate links out to other sites.

This used to not be such a problem, since no one validated RSS files. Lately, though, all I've run into are validating parsers -- the RSS aggregator I use (Newsdesk) won't even load my own RSS feed (, nor will the validator at

Aside from potentially filtering the output from CityDesk through a PHP script when it's requested, does anyone have any ideas on forcing CD to spit out fully qualified URLs in the internal links it creates? Sadly, RSS has no BASE element, like HTML.

M.S. Manley
Thursday, March 6, 2003

Unfortunately there's no easy way to do this other than making sure the rss file is in the same directory as the things that are being linked to.

It's non-trivial for us to implement this feature, because the way CityDesk is set up, with publish locations being separate from publishing, CityDesk doesn't actually >know< the URL it is publishing for, and therefore can't easily produce an absolute URL. But we'll find some kind of way to do it for the next version.

Joel Spolsky
Friday, March 7, 2003

Thanks, Joel. I'd considered the solution of keeping the RSS in the same spot as the stories, but that still doesn't quite solve the problem, as any link in the text of .teaser is still not fully qualified. Once the RSS is in someone's aggregator, that link in .teaser points to nowhere.

Luckily, CD lets you slice and dice things in a number of ways, so I took a different route. I'm taking the .teasers and writing them out to a PHP array. Another PHP script on the site reads that file, fixes the links in each entry, and depending on the flavor of RSS requested, assembles the proper XML on demand. Yeah, it would be nice to skip the fix-up step, but all things considered, that's not such a horrible thing to do, as long as the HTML generated is reasonably clean.


M.S. Manley
Monday, March 10, 2003

Does it work if you make the hrefs in your teaser look like "{$.link$}"?

Darren Collins
Monday, March 10, 2003

?? Won't abslink work here? My site has RSS... it may not be valid, but Frontier/Radio doesn't seem to care and reads it... I modelled mine after the Slashdot RSS feed. - posting while on vacation (I have some down time)
Monday, March 10, 2003

If I hardcoded the links in the teaser that way, yes it would work just fine. However, I use the [[link to story]] construct in the teasers and that's always a relative link.

M.S. Manley
Wednesday, March 12, 2003

Mark --

In general, I run away from anything involving Radio/Frontier. :) I switched to CityDesk from Radio, in fact, for my blogging, and to Newsdesk for my RSS aggregation.

The strictness of RSS parsers is a subject of no small debate in the aggregator developer community, it seems. Userland's RSS aggregator in Radio is particularly forgiving. After developing HTML through the browser wars, I'm not particularly fond of systems that play fast and loose with their own specifications. :)


M.S. Manley
Wednesday, March 12, 2003

Ah, the [[link]] would be problematic. I just never use them.

If anyone's interested, here's my RSS code. I don't know how good it is, but here it is for you to use:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"

<rss version="0.91">

  <description>Dedicated to music and design.</description>
  <copyright>Copyright 2001 Mark Wieczorek.</copyright>

{$ foreach 10 x in (keyword_contains "(news)") sortdescendby .fileddate$}

Wednesday, March 12, 2003

Yeah, that's the type of link structure I was thinking about.

Darren Collins
Thursday, March 13, 2003

*  Recent Topics

*  Fog Creek Home