By Shahed Nooshmand

I’ve switched from Atom to RSS. References to the “Atom feed” name on the website have been replaced by “RSS” and the old feed URL redirects to the new one, so subscribers don’t have to do anything to get new content.

Why did I do it? Because my valid feed was getting a warning.

Rafraîchissoir’s Atom feed has always been valid — like its HTML and CSS — but Atom requires every <entry> to have a <title>, and many of the posts here — e.g. this one — are titleless. Because I insist on everything to be valid, I left the title in the feed blank, like this: <title></title>. Feed validity notwithstanding, the validator showed a warning that “title should not be blank”, and that drove me nuts.

RSS, on the other hand, doesn’t require a <title> if the <item> has a <description>. It will still warn about empty titles, but that’s not really a problem since you can omit the title altogether.

The new RSS feed isn’t plain RSS, though. It uses the Atom namespace for declaring its own <atom:link> with the rel='self' attribute, because if it doesn’t, it gets a warning and the whole point of my switching to RSS is to avoid warnings.

I also had to do some manual date formatting. Atom and JSON feed both use the same date format, which happens to be the same format Raku uses to represents date and time. RSS, however, uses a different format which, albeit slightly easier to read, is a bit harder to generate. Here’s what today looks like in Atom and JSON feed (you can get this by calling now.Date.DateTime):


The same date and time in RSS would be:

Fri, 11 Sep 2020 00:00:00 +0000

The weekday part is optional — so is the second part — and this particular timezone could alternatively be shown as “GMT” or “UT” or even “Z”. The expression I used in Raku to convert the first format to the second looks like (but isn’t exactly) this:

"%weekdays{.day-of-week}, {.day} %months{.month} {.year} {.hh-mm-ss} +0000"

Where $_ is a Raku DateTime object in UTC, and %weekdays and %months are hashes of weekday and month abbreviations accessible by their numbers — 1 is Monday and January. (In the actual script I’m using to generate the feed, these hashes store the full names, because the same script does other things in other places where I want the full names and not the short names. To get the three-letter name I just call .substr(^3) on the full name.)

Now I can sleep at night, knowing my feed is 100% valid with no warning.