First attempt at creating per-category Atom feeds. #201

merged 2 commits into from Oct 16, 2011


None yet

2 participants


One of the things I've missed from Octopress is per-category RSS/Atom feeds. Many open source projects have "planet" sites where they aggregate community blogs, but they want a feed of only the relevant posts – Planet Drupal only wants posts about Drupal, for example.

This is my first Ruby code ever, so I more or less expect that I've done something horrible here, but it does work, and I'm currently in the process of deploying it to my own blog.

So I'd really like to hear how this could be improved :)

@mikl mikl commented on the diff Oct 4, 2011
+ <link href="{{ site.url }}/"/>
+ <updated>{{ site.time | date_to_xmlschema }}</updated>
+ <id>{{ site.url }}/</id>
+ <author>
+ <name><![CDATA[{{ | strip_html }}]]></name>
+ {% if %}<email><![CDATA[{{ }}]]></email>{% endif %}
+ </author>
+ <generator uri="">Octopress</generator>
+ {% for post in site.categories[page.category] limit: 5 %}
+ <entry>
+ <title type="html"><![CDATA[{{ post.title | cdata_escape }}]]></title>
+ <link href="{{ site.url }}{{ post.url }}"/>
+ <updated>{{ | date_to_xmlschema }}</updated>
+ <id>{{ site.url }}{{ }}</id>
+ <content type="html"><![CDATA[{{ post.content | expand_urls: site.url | markdownify | cdata_escape }}]]></content>
mikl Oct 4, 2011

I had to add markdownify here to get my content rendered properly. This confounds me, since the other templates that I've looked at didn't have to do this.

@fhemberger fhemberger merged commit d84daa2 into imathis:master Oct 16, 2011

Cool feature, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment