I just want a feed for my website...
While writing the generator for this site, i decided to implement an rss feed for the rare case that someone is interested in being up to date with my posts (i'm a big dreamer, ik). It was all fun and games when i got into it, just read the rss specification, write a template with the site info and generate a posts list. Pronto, i have a feed now yay! Or so i thought...
A brief look at blog feed formats
When going down this rabbit hole, these are the formats i stumbled upon:
- RSS (Rich Site Summary)
- RSS (RDF Site Summary)
- RSS (Really Simple Syndication)
- Atom (RSS but different)
- JSONFeed (RSS but JSON)
Now yes, i might be stretching it too much with rss, but seriously, who thought changing the name with each version was a good idea? But with that aside, let's see how these formats differ and what they have in common, starting with rss (i'll use 2.0 since it is the latest version):
<rss version="2.0">
<channel>
<title>NASA Space Station News</title>
<link>http://www.nasa.gov/</link>
<description>
A RSS news feed containing the latest NASA press releases on the International Space Station.
</description>
<language>en-us</language>
<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
<lastBuildDate>Fri, 21 Jul 2023 09:04 EDT</lastBuildDate>
<docs>https://www.rssboard.org/rss-specification</docs>
<generator>Blosxom 2.1.2</generator>
<managingEditor>neil.armstrong@example.com (Neil Armstrong)</managingEditor>
<webMaster>sally.ride@example.com (Sally Ride)</webMaster>
<item>
<title>
Louisiana Students to Hear from NASA Astronauts Aboard Space Station
</title>
<link>
http://www.nasa.gov/press-release/louisiana-students-to-hear-from-nasa-astronauts-aboard-space-station
</link>
<description>
As part of the state's first Earth-to-space call, students from Louisiana will have an opportunity soon to hear from NASA astronauts aboard the International Space Station.
</description>
<pubDate>Fri, 21 Jul 2023 09:04 EDT</pubDate>
<guid>
http://www.nasa.gov/press-release/louisiana-students-to-hear-from-nasa-astronauts-aboard-space-station
</guid>
</item>
</channel>
</rss>
Looks alright to me, there's some bonkers stuff like managingEditor and webMaster, but thats optional
and you dont need to have it if you don't want to. But the important thing here is that rss does what it needs to do, it gives you
a feed to add content and some metadata as well. Let's take a look now at the atom sample feed:
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Example Feed</title>
<link href="http://example.org/"/>
<updated>2003-12-13T18:30:02Z</updated>
<author>
<name>John Doe</name>
</author>
<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
<entry>
<title>Atom-Powered Robots Run Amok</title>
<link href="http://example.org/2003/12/13/atom03"/>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
<updated>2003-12-13T18:30:02Z</updated>
<summary>Some text.</summary>
</entry>
</feed>
Yeah, kinda the same thing, just a little different. You can look at the spec to see which fields are available. One notable feature is that it treats the author as an object, with many possible fields, also you can have a different author for each article. Now to our last one, JSONFeed:
{
"version": "https://jsonfeed.org/version/1.1",
"title": "My Example Feed",
"home_page_url": "https://example.org/",
"feed_url": "https://example.org/feed.json",
"items": [
{
"id": "2",
"content_text": "This is a second item.",
"url": "https://example.org/second-item"
},
{
"id": "1",
"content_html": "<p>Hello, world!</p>",
"url": "https://example.org/initial-post"
}
]
}
Well, it's json... Now we have 3 (or maybe even more idk) formats that do the same thing in almost the same way (jsonfeed is json but yeah)
They're all... the same?
One thing to note is that a feed is what it is and there is not much to change. So yeah, there's not much room for improvement here (shrug) I'd like to point out that i really like jsonfeed because it is so easy to operate using python, since JSON can be read directly into a dictionary and it makes it very easy do edit and save back.