Developer docs

How to make an iTunes Podcast RSS feed with Ghost

Ghost comes with automatic RSS feeds for your content, but you can also create a custom feed using the flexible dynamic routing layer to support specific content types, like videos and podcasts.

Adding /rss/ to most URLs in Ghost produces an automatically generated RSS feed for your content. If you’re publishing a podcast on your Ghost site then you’ll probably want to create a custom RSS feed to distribute your podcast episodes to places like iTunes.

This tutorial walks you through how to create a custom RSS route using dynamic routing, as well as a Handlebars template for your RSS feed that is fully optimised for a podcast and iTunes.

Add a new route for your RSS feed

The first thing to do is add a new route where your RSS feed will exist in the using the dynamic routing layer in Ghost. Download the most up to date version of your routes.yaml file from Ghost Admin settings menu and open it in your code editor of choice.

For the purposes of this example, we’re adding this to our podcast collection - here’s what it looks like:

    template: podcast/rss
    content_type: text/xml

Note that this assumes we already have a collection in place for the podcast content, which would appear under collections in the routes.yaml file like so:

    permalink: /blog/{slug}/
    filter: tag:blog+tag:-podcast
    permalink: /podcast/{slug}/
    filter: tag:podcast+tag:-blog

If you haven’t yet setup your podcast content in Ghost, then you can use this tutorial on content collections as a guide.

Create a new template for an iTunes RSS feed

Now you’ve updated the routes.yaml, you’ll need to create a new Handlebars template in your theme. This requires a little bit of coding, but you can use the example provided in this tutorial as a starting point.

Define your podcast channel for iTunes

In order for iTunes to understand your RSS feed, there a few basic requirements that you need to include at the start of your new template, which defines the type of RSS feed and some basic information about your podcast. Below is an example of the required information for an iTunes podcast, which you can copy into your own template and replace with necessary information:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="" xmlns:wfw=""
    xmlns:dc="" xmlns:atom="" xmlns:sy=""
    xmlns:slash="" xmlns:itunes=""
    xmlns:rawvoice="" xmlns:googleplay="">

<copyright>{{@site.title}} Copyright {{date format="YYYY"}}</copyright>
<atom:link href="{{@site.url}}/podcast/rss/" rel="self" type="application/rss+xml" />
<lastBuildDate>{{date format="ddd, DD MMM YYYY HH:mm:ss ZZ"}}</lastBuildDate>
    <itunes:name>Your Name</itunes:name>
<itunes:image href="{{img_url @site.icon absolute="true"}}"/>
<itunes:category text="Technology"></itunes:category>

{{#get "posts" filter="tag:podcast" include="tags,authors" as |episode|}}
    {{#foreach episode}}
        <link>{{url absolute="true"}}</link>
        <pubDate>{{date format="ddd, DD MMM YYYY HH:mm:ss ZZ"}}</pubDate>
        <guid isPermaLink="false">{{id}}</guid>
        <category><![CDATA[ {{}} ]]></category>
        <content:encoded><![CDATA[ {{content}} ]]></content:encoded>
        <enclosure url="{{og_description}}" length="0" type="audio/mpeg"/>
        <itunes:summary><![CDATA[ {{content}} ]]></itunes:summary>


You can copy and paste this exact implementation for your site, then go ahead and customise it to suit your needs! There are a couple of static variables which need to be adjusted, like your name, email, and the iTunes category you want to appear in.

There’s also one very small hack/workaround that makes all of this work: The feed requires that you specify the podcast mp3/audio file URL for each episode. Because Ghost doesn’t have custom fields, we can repurpose the Facebook Description field for each post to store the link to the audio file.

So wherever you upload your audio to, just paste the provided URL into the Facebook Description and you should be all set.

Update routes.yaml and your active theme

Once you’re happy with your work, upload a new version of routes.yaml and update your active theme in Ghost Admin to enable your new RSS feed. Once you have done this, you should be able to visit the feed at /podcast/rss/ to ensure it’s working as desired and submit it to iTunes.


Success! You should have implemented your very own custom iTunes RSS feed for podcast content on your Ghost site using dynamic routing and a Handlebars template. Don’t forget you can get more in-depth information about the Handlebars theme layer in Ghost in the docs.