How to generate RSS feed for a tag in Octopress
By default you have only one RSS (Atom) feed in your Octopress blog. But what if you want to provide a separate feed for some particular tag? You can do it quite easily.
And actually it already works out-of-the-box. Go to the /path/to/your/blog/_deploy/blog/categories/
and see for yourself - each folder (with a name of the corresponding tag) contains an atom.xml
feed. If you don’t have it, then turn it on in the /path/to/your/blog/_config.yml
:
category_feeds: true
But I don’t want to have feeds for all my tags (so I tried to set category_feeds
to false
, but that didn’t change anything), and they are being stored in a not that obvious place, and also I would like to customize it a bit, so here I’ll show you how to do it with a “qt” tag of my blog as an example.
Find a file /path/to/your/blog/source/atom.xml
and make a copy of it with a different name, for example atom.qt.xml
. Open it in text editor and replace
{% for post in site.posts limit: 20 }
with
{% for post in site.categories["qt"] limit: 20 %}
Basically, that’s all the magic. You might want to change the number of posts to show (limit
variable) and also edit some meta-information:
<title><![CDATA[{{ site.title | cdata_escape }} | Qt]]></title>
<link href="{{ site.url }}/atom.qt.xml" rel="self"/>
<link href="{{ site.url }}/blog/categories/qt/"/>
And now after generating and publishing changes you will have a new feed available, containing only posts with the tag you specified. You can also set it as a default feed for you blog in the /path/to/your/blog/_config.yml
(however, I don’t see much point in that):
# RSS / Email (optional) subscription links
subscribe_rss: /atom.qt.xml
Almost all the information came from this article, I only made some tweaks in regard to Octopress.
Social networks
Zuck: Just ask
Zuck: I have over 4,000 emails, pictures, addresses, SNS
smb: What? How'd you manage that one?
Zuck: People just submitted it.
Zuck: I don't know why.
Zuck: They "trust me"
Zuck: Dumb fucks