Writing an atom feed manually
This guide explains how to write and update an atom feed manually.
We don't need a blogging platform, a CMS or a site generator in order to syndicate our own feed! We can just create a file manually and update it when we have an update to share. Boring is a virtue!
The first step is to create your feed's file. For atom, the convention is to call it
feed.atom. Go ahead and do it! Once you have it, copy and paste the following into it:
<?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <title>m15o</title> <id>https://m15o.ichi.city/</id> <link rel="self" href="https://m15o.ichi.city/feed.atom"></link> <link rel="alternate" href="https://m15o.ichi.city" type="text/html"></link> <updated>UPDATED_DATE</updated> <author> <name>m15o</name> </author> </feed>
Make sure to replace the various parts with your information.
For now, you can replace UPDATED_DATE with today's date. The format is the following: YYYY-MM-DDT00:00:00.0Z. Replace YYYY with the current year, MM with the current month, and DD with the current day. You can leave the rest as is.
You can now upload this file at the root of your site. In my case, you'll find it at
https://m15o.ichi.city/feed.atom. Go ahead and upload it, I'll be waiting.
To verify that the feed is valid, you can use this feed validator from the w3c.
Add an entry
When you do something noteworthy on your site, such as adding a new post, updating a section or anything else, you can add an
entry to your feed so that people can be notified.
Suppose we just updated the layout of our site, and we'd like to mention it in our feed. To do that, let's open
</author>, let's add:
<entry> <title>New layout!</title> <id>1</id> <published>PUBLISHED_DATE</published> <updated>UPDATED_DATE</updated> <author> <name>m15o</name> </author> <content type="html"><![CDATA[I've updated my layout!]]></content> </entry>
There we have it! Make sure you update the PUBLISHED_DATE and UPDATED_DATE of the entry to the same value, following the same format as we used above. Speaking of which, also update your feed's
<updated> value to that date as well.
Make sure you close the last
</feed>. Upload it to your site, and that's it! Everyone will be able to see the update.
If you're interested in learning more about what's possible with atom, have a look at the spec. It's well written and explains each part.