Jack Barber / Website Design

Podcast RSS Feed Template

Podcast RSS Feed Template

I recently had to fix a podcast feed I'd created for Whitby Christian Fellowship a few years ago. It had broken and needed re-submitting to iTunes for inclusion in the iTunes podcast store.

It took a bit of fiddling about to get it working again, so I thought I'd post the framework for the feed, in case anyone else was in need of an iTunes podcast RSS template:

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<channel>
<title>Title of Podcast</title>
<link>http://www.example.com/<link>
<language>en-us</language>
<itunes:subtitle>Subtitle of podcast</itunes:subtitle>
<itunes:author>Author Name</itunes:author>
<itunes:summary>Description of podcast.</itunes:summary>
<description>Description of podcast.</description>
<itunes:owner>
    <itunes:name>Owner Name</itunes:name>
    <itunes:email>me@example.com</itunes:email>
</itunes:owner>
<itunes:explicit>no</itunes:explicit>
<itunes:image href="http://www.example.com/podcast-icon.jpg" />
<itunes:category text="Category Name"/></itunes:category>

<!--REPEAT THIS BLOCK FOR EACH EPISODE-->
<item>
    <title>Title of Podcast Episode</title>
    <itunes:summary>Description of podcast episode content</itunes:summary>
    <description>Description of podcast episode content</description>
    <link>http://example.com/podcast-1</link>
    <enclosure url="http://example.com/podcast-1/podcast.mp3" type="audio/mpeg" length="1024"></enclosure>
    <pubDate>Thu, 21 Dec 2016 16:01:07 +0000</pubDate>
    <itunes:author>Author Name</itunes:author>
    <itunes:duration>00:32:16</itunes:duration>
    <itunes:explicit>no</itunes:explicit>
    <guid>http://example.com/podcast-1</guid>
</item> 
<!--END REPEAT--> 
   
</channel>
</rss>

This feed is powered by PHP so most of the variables are constructed on the fly - obtained from a MySQL database of sermon recording records.

A Few Notes:

  • The image must be at least 1400px by 1400px and at most 4000px by 4000px and a JPG
  • The <guid> link on each recording needs to be different for each episode
  • The <pubDate> can be generated in php using date('r'); - or a mktime() function on existing data
  • Duration does not need to be accurate
  • The length='' criteria on <enclosure> must be at least 1, but does not need to be accurate (this is recording size in bytes)

Content Type

If you build your feed in PHP, echoing out all the data, you will need to set the content type header to XML at the top of your file, like this:

header("Content-type: text/xml");

Validation

The best feed validator I found was: http://validator.w3.org/feed/