Custom RSS

Custom RSS + Ghost

How to use Ghost and Custom RSS together

Create custom RSS feeds for your publication using the flexible dynamic routing layer in Ghost and Handlebars templates

Adding /rss/ to most URLs in Ghost produces an automatically generated rss feed, for example:

Automatic rss feeds save time, and allow external applications to access an up-to-date feed of your content. However, when the default implementation of rss feeds in Ghost doesn’t suit your requirements, you can create custom feeds using the dynamic routing layer and a Handlebars template.

Here’s an example of how to create a custom rss feed for a specific route on a Ghost publication:

Add an rss route in routes.yaml:

In order to create a custom rss feed you’ll need to add a new route, which is the URL where your feed will appear.

Download the latest version of the routes.yaml file from Ghost Admin and open it in any code editor:

Under routes add the URL where your new custom rss feed will exist, for example:

    template: news/rss
    content_type: text/xml

Custom rss feeds need to be defined with the content_type property and mapped to a template as shown in the example above.

Create an new template

The next step is to create a custom template in your theme. Following the example above, create a new template with the file name: news/rss.hbs. Here’s a code example of what a custom rss template can look like:

<rss xmlns:dc="" xmlns:content="" xmlns:atom="" xmlns:media="" version="2.0">
<title><![CDATA[ {{@site.title}} ]]></title>
<description><![CDATA[ {{@site.description}} ]]></description>
<lastBuildDate>{{date format="ddd, DD MMM YYYY HH:mm:ss ZZ"}}</lastBuildDate>
<atom:link href="{{@site.url}}" rel="self" type="application/rss+xml"/>

{{#get "posts" limit="all" include="authors,tags"}}
    {{#foreach posts}}
        <title><![CDATA[ {{title}} ]]></title>
        <description><![CDATA[ {{excerpt}} ]]></description>
        <link>{{url absolute="true"}}</link>
        <guid isPermaLink="false">{{id}}</guid>
        <category><![CDATA[ {{}} ]]></category>
        <dc:creator><![CDATA[ {{}} ]]></dc:creator>
        <pubDate>{{date format="ddd, DD MMM YYYY HH:mm:ss ZZ"}}</pubDate>
        <media:content url="{{feature_image}}" medium="image"/>
        <content:encoded><![CDATA[ {{content}} ]]></content:encoded>


You can copy and paste this exact implementation for your site, then go ahead and customise it to suit your needs!

Update your active theme and routes.yaml

Once you’ve saved your changes, upload your updated theme in Ghost Admin as a .zip file and upload your new routes.yaml file. That’s it, you’ve successfully created a custom RSS feed - you can test it out for yourself using the feed’s URL!

Advanced RSS feeds for podcasting

If you’re looking for a more detailed examples specifically for generating an iTunes compatible podcast RSS feed, make sure you check out our in-depth podcast feed tutorial for Ghost, which builds on the things covered here!

Do more with Zapier

As always, you can power up your site even further using Zapier. Check out some of these powerful RSS automations: