Create a Podcast with Dato

Here’s a Ruby Builder script to create a podcast feed using Dato. It’s super simple but took me some time to review the various standards and get it validating in iTunes Connect. Enjoy!

The only thing that doesn’t currently work is the value, as Dato currently doesn’t calculate this for audio files. I hope this is added soon, as it’s great to have a site’s podcast all in the same CMS and with easy static hosting of the feed.

xml.instruct! :xml, version: "1.0"

rss_attributes = {
  "version" => "2.0",
  "xmlns:dc" => "",
  "xmlns:sy" => "",
  "xmlns:atom" => "",
  "xmlns:rdf" => "",
  "xmlns:content" => "",
  "xmlns:itunes" => "",
  "xmlns:media" => ""

xml.rss rss_attributes do do
    xml.title podcast.title
    xml.language "en-GB"
    xml.description podcast.description podcast_feed_url
    xml.atom :link, href: podcast_feed_url, rel: "self", type: "application/rss+xml"

    xml.itunes :author,
    xml.itunes :subtitle, podcast.subtitle
    xml.itunes :explicit, "clean"
    xml.itunes :category, text: podcast.category
    xml.itunes :image, href: podcast.artwork.url(w: 1500, h: 1500, fit: :crop)

    xml.itunes :owner do
      xml.itunes :name,
      xml.itunes :email,

    podcast.episodes.each do |episode|
      xml.item do
        xml.title episode.title
        xml.description episode.description
        xml.guid podcast_episode_url(episode), isPermaLink: true podcast_episode_url(episode)

        xml.itunes :author,
        xml.itunes :subtitle, episode.subtitle
        xml.itunes :duration,
        xml.itunes :image, href: episode.artwork.url(w: 1500, h: 1500, fit: :crop)
        xml.itunes :explicit, "clean"

        xml.enclosure url:, length:, type: "audio/mpeg" :content, url:, type: "audio/mpeg"
1 Like

Thank you very much for this!!! :slight_smile: