Learn How to Create an Atom Feed for You Website
If you’ve familiarized yourself with the Atom feed and its abilities, you might want to create one for yourself. Atom is becoming more and more popular. Even Google uses Atom for Blogger service, for example. It is similar XML format to RSS (really simple syndication), but it’s newer than RSS and provides more flexibility.
Atom offers little more options to developers than RSS technology. Atom allows web developers to have one consistent format for syndicating and authoring the content on the internet. You can do a little more research about Atom feeds, but if you decided to create one, then here’s some information on how to do it.
First, you need to understand what kind of elements an Atom feed contains. Let’s look at the simple Atom feed example and analyze it.
Basic Atom Feed Example
<?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <title>Example Atom Feed</title> <subtitle>Insert a Subtitle Here</subtitle> <link href="http://domain.com"/> <updated>2006-12-13T18:20:02Z</updated> <author> <name>Your Name</name> <email>email@example.com</email> </author> <entry> <title>Your Title Here</title> <link href="http://domain.com/page/ "/> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> <updated>2006-12-13T18:20:02Z</updated> <summary>Short Summary</summary> </entry> </feed>
The first line is declaring that this is an XML document (just like in RSS).
<?xml version="1.0" encoding="utf-8"?>
The second line declares that we’re using w3.org namespaces. This declaration allows us to use elements described in the site.
In the third line we see “title” element. It actually works the same as a channel title element in RSS feed.
The fourth element, called <subtitle> is a short description of the feed. It’s like <description>element in RSS channel.
<subtitle>Insert a Subtitle Here</subtitle>
Link and updated elements are analogs in RSS, they represent the URL of a feed and update time.
<link href="http://domain.com/"/> <updated>2006-12-13T18:20:02Z </updated>
Author’s name and email can also be put in the Atom feed.
<author> <name>Your Name</name> <email>firstname.lastname@example.org</email> </author>
And then there’s the <entry> element. It works the same as <item> element in RSS feed.
<entry> <title>Your Title Here</title> <link href="http://domain.com/page/ "/> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> <updated>2006-12-13T18:20:02Z</updated> <summary>Short Summary<summary> </entry>
In <entry> there are “title, link, summary” elements that give readers the title, description (summary) about your message and link to the page where people can read more information.
The trickiest is the <id> tag in Atom feed. This element is mandatory in every Atom feed. It should be globally unique across all the feeds and never change in the entry. Every entry should have its own unique <id> tag, but it must never change, even if the entry is updated, because some feed readers, redisplay the same entry if it’s updated.
How to Make Your Own id tag in Your Atom Feed?
Take the URL of your article or post that is linked by the entry, for example. Like:
Remove everything that appears before the domain, so it looks like:
Right after the domain, insert a comma, then the four-digit year, two-digit month, and two-digit day divided by dashes that tell when the info was posted. And finally include the colon, so it looks like this:
Then add tag: in front of the domain.
That’s it, now you have your <id>element for an entry.
Content Element in Atom Feed
Above, we have a basic, but complete Atom feed that we can put into the XML file, upload to our servers and offer to visitors. However, there’s one more important element that we haven’t covered yet. It’s called <content> element and it is important.
RSS has the <description> element that is used to display just a short portion of text (commonly used) and the full content in it.
Atom uses two different elements for displaying description – <summary> and <content> elements. The summary is used for compatibility reasons if the content is non-textual.
Atom feed creation is not very difficult, however it may seem tricky for some. Updating Atom feed by hand can be a hassle. If you want to have an Atom feed, but also easily update content, you can subscribe to Blogger blogging service account for free and offer Atom feeds on your site within minutes.
There’s actually no big difference which feed you are going to create for your site. If you want to make an Atom feed, go ahead and do so. On the other hand, RSS feeds might look simpler and easier to maintain. Remember that both of them are supported by almost all feed readers.