Skip to content

Instantly share code, notes, and snippets.

@kedronrhodes
Created January 15, 2021 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kedronrhodes/cae4be036ed0070363049d5bc6262b63 to your computer and use it in GitHub Desktop.
Save kedronrhodes/cae4be036ed0070363049d5bc6262b63 to your computer and use it in GitHub Desktop.
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0">
<channel>
<title>{{ $.Site.Params.feed.podcast_title }}</title>
<atom:link href="{{ "podcast/feed.xml" | absURL }}" rel="self" type="application/rss+xml" />
<link>{{ .Site.BaseURL }}podcast</link>
<description>{{ .Site.Params.feed.itunes_summary | truncate 4000 ""}}</description>
<lastBuildDate>{{ dateFormat "Mon, 2 Jan 2006 15:04:05 -0700" .Date }}</lastBuildDate>
<sy:updatePeriod>weekly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<language>{{ .Site.Params.feed.language | default .Site.LanguageCode }}</language>
<copyright>{{ .Site.Params.feed.copyright }}</copyright>
{{ with .Site.Params.feed.itunes_subtitle }}<itunes:subtitle>{{ . }}</itunes:subtitle>{{ end }}
<itunes:author>{{ .Site.Params.feed.itunes_author }}</itunes:author>
<itunes:type>episodic</itunes:type>
<googleplay:author>{{ .Site.Params.feed.itunes_author }}</googleplay:author>
<googleplay:email>{{ .Site.Params.feed.itunes_owner_email }}</googleplay:email>
<itunes:summary>{{ .Site.Params.feed.itunes_summary | truncate 4000 ""}}</itunes:summary>
<googleplay:description>{{ .Site.Params.feed.itunes_summary | truncate 4000 ""}}</googleplay:description>
<itunes:owner>
<itunes:name>{{ .Site.Params.feed.itunes_owner_name }}</itunes:name>
<itunes:email>{{ .Site.Params.feed.itunes_owner_email }}</itunes:email>
</itunes:owner>
<itunes:image href="{{ .Site.Params.feed.itunes_image }}" />
<googleplay:image href="{{ .Site.Params.feed.itunes_image }}"></googleplay:image>
<image>
<url>{{ .Site.Params.feed.itunes_image }}</url>
<title>{{ $.Site.Params.feed.podcast_title }}</title>
<link>{{ .Site.BaseURL }}</link>
</image>
<itunes:category text="{{ .Site.Params.feed.itunes_top_category }}">
{{ with .Site.Params.feed.itunes_first_sub_category -}}
<itunes:category text="{{ . }}" />
{{- end -}}
{{- with .Site.Params.feed.itunes_second_sub_category -}}
<itunes:category text="{{ . }}" />
{{- end -}}
</itunes:category>
{{- if isset .Site.Params.feed "explicit" -}}
<itunes:explicit>{{ .Site.Params.feed.explicit }}</itunes:explicit>
<googleplay:explicit>{{ .Site.Params.feed.explicit }}</googleplay:explicit>
{{- end -}}
<generator>Hugo -- gohugo.io</generator>
{{- range (where ( where .Site.Pages "Type" "podcast") ".Params.upcoming" "!=" true) -}}
{{ if isset .Params "podcast_file" }}
<item>
<title>{{ title .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} </pubDate>
<dc:creator>{{ .Site.Params.feed.itunes_author }}</dc:creator>
<guid>{{- if isset .Params "guid" -}}{{ .Params.guid }}{{- else -}}{{ .Site.Params.media_prefix }}{{ .Params.podcast_file }}{{- end -}}</guid>
<itunes:author>{{ .Site.Params.feed.itunes_author }}</itunes:author>
{{ with .Params.season }}
<itunes:season>{{ . }}</itunes:season>
{{ end }}
{{ with .Params.episode }}
<itunes:episode>{{ . }}</itunes:episode>
{{ end }}
<itunes:title>{{ title .Title }}</itunes:title>
{{"<itunes:subtitle><![CDATA[" | safeHTML }}
{{ with .Params.subtitle }}
{{ . | plainify | truncate 243 "..." }}
{{ else }}
{{ .Description | plainify | truncate 243 "..." }}
{{ end }}
{{"]]></itunes:subtitle>" | safeHTML}}
<itunes:summary>{{ .Description | plainify }}</itunes:summary>
<description>{{ .Description | plainify }}</description>
<googleplay:description>{{ .Description | plainify }}</googleplay:description>
<content:encoded>{{ printf "<![CDATA[%s]]>" .Content | safeHTML }}</content:encoded>
{{- with .Params.episode_image -}}
<itunes:image href="{{ . | absURL }}"></itunes:image>
<googleplay:image href="{{ . | absURL }}"></googleplay:image>
{{- end -}}
<enclosure url="{{ .Site.Params.media_prefix }}{{ .Params.podcast_file }}" {{with .Params.podcast_bytes}}length="{{ . }}"{{ end }} type="audio/mpeg" />
{{- with .Params.podcast_duration -}}<itunes:duration>{{ . }}</itunes:duration>{{- end -}}
{{- with .Params.explicit -}}
<itunes:explicit>{{ if (or (eq . "yes") (eq . "true")) }}true{{ else }}false{{ end }}</itunes:explicit>
<googleplay:explicit>{{ if (or (eq . "yes") (eq . "true")) }}yes{{ else }}no{{ end }}</googleplay:explicit>
{{- end -}}
</item>
{{- end -}}
{{- end -}}
</channel>
</rss>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment