Ninja Ferret

The random thoughts of a software developer

Creating an Atom Feed on GitHub Pages

Like any good blog I need an feed so that the many people who are addicted to my random ramblings can follow me using their news readers. So, how would I do that?

The atom feed is simply an XML document and the Liquid Templating engine can generate anything that you want so I searched on-line and found some atom samples and used them to generate this Atom feed file:

layout: null
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="">
  <title>Ninja Ferret</title>
  <link href="" rel="self"/>
  <link href=""/>
  <updated>{{ site.time | date_to_xmlschema }}</updated>
    <name>Ian Johnson</name>
    <email>[email protected]</email>
  {% for post in site.posts %}
      <title>{{ post.title }}</title>
      <link href="{{ post.url }}"/>
      <updated>{{ | date_to_xmlschema }}</updated>
      <id>{{ }}</id>
      <content type="html">{{ post.content | xml_escape }}</content>
  {% endfor %}

And there is it, it's a simple file to create that will build an atom feed for your site.


blog comments powered by Disqus