Modifying template output

I’ve hit a problem with the official instructions for creating a podcast RSS feed. If you follow the instructions, your feed will have two big issues both related to the way the post body content is rendered in the template for each episode.

  1. The contents of the <itunes:summary> are, according to the format spec, plaintext only. They’re rendered as HTML here, and will either fail validation or appear in the podcast client as raw HTML.
  2. The contents of <description><content> render with all of the cards and embeds that make sense in Ghost’s context, but definitely won’t play nicely with iTunes or other podcast apps.

What’s needed is a way of taking the post content and making it appropriate for the RSS feed. Thinking of ways to deal with this, is there any Handlebars-native way of modifying content in a specific way, like, for example Django Template Filters? Failing that, is there a way to trim template output via regex?

Looking at this document, I don’t see where itunes:summary is specified. Can you link your specs document?

Thanks for pointing that out, looks like the summary tag has been droppped from the spec, so that’s one less thing to worry about! I think the fact it was still in the Ghost podast template in the docs I linked to in the original post (last element of the item tag) was what threw me.

The other one is still a problem, though. If I upload an audio file into the post, it’s going to try and render the card in podcast apps, which isn’t going to look good at all. I can see Wave uses {{custom_excerpt}}, which will get around that problem, but means not having any HTML in the description at all. Which when you want to include links in the show notes is a bit of a problem…

One possibility would be to not link the audiofile in the post body. Instead, put the link to it in an unused field (or code injection) and then update the template for the post.hbs to include it. That’s what at least one of the Ghost podcast themes I’ve looked at does.