Skip to content

Instantly share code, notes, and snippets.

@nbr23
Created April 10, 2026 02:42
Show Gist options
  • Select an option

  • Save nbr23/2b330af8a4af65ba73cadc1d7a805b33 to your computer and use it in GitHub Desktop.

Select an option

Save nbr23/2b330af8a4af65ba73cadc1d7a805b33 to your computer and use it in GitHub Desktop.
{{ $style := resources.Get "xsl/style.xsl" | resources.ExecuteAsTemplate "podcast-style.xsl" (dict "Site" .Site "IsPodcast" true) }}
{{ printf "<?xml-stylesheet type=\"text/xsl\" href=\"" | safeHTML }}{{ $style.Permalink }}{{ printf "\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
<channel>
<title>{{ .Site.Title }}</title>
<link>{{ .Permalink }}</link>
<description>{{ $.Site.Params.description }}</description>
{{ with .Site.LanguageCode }}<language>{{ . }}</language>{{ end }}
<itunes:image href="{{ .Site.BaseURL }}images/podcast-cover.png"/>
<itunes:explicit>no</itunes:explicit>
{{ if not .Date.IsZero }}<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{ with .OutputFormats.Get "Podcast" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{ range .Site.RegularPages }}
{{ if .Params.podcast }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<guid>{{ .Permalink }}</guid>
<description>{{ with .Description }}{{ . }}{{ else }}{{ .Summary | plainify | replaceRE "Listen to this post:\\s*" "" | strings.TrimSpace }}{{ end }}</description>
<enclosure url="{{ printf "%saudio/tts/%s.mp3" .Site.BaseURL .File.ContentBaseName }}" type="audio/mpeg" />
</item>
{{ end }}
{{ end }}
</channel>
</rss>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment