make the main page RSS feed sensitive to different content types

This commit is contained in:
Greg Gauthier 2022-01-04 18:54:38 +00:00
parent 60ce1e0b31
commit 75afa9f040

View File

@ -39,25 +39,40 @@
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
{{ if isset .Params "image" }}
{{ $cdnUrl := .Site.Params.blogCdnUrl }}
{{ with .Params.image }}
<enclosure url="{{ $cdnUrl }}{{ . }}" type="image/jpg"/>
{{ end }}
{{ end }}
<!-- *** THE ENCLOSURE PARAMETER WILL BE TREATED AS A SIGNAL THAT THIS IS A PODCAST *** -->
{{ if isset .Params "enclosure" }}
{{ $cdnUrl := .Site.Params.podcastCdnUrl }}
<enclosure url="{{$cdnUrl}}{{.Params.enclosure}}" type="audio/mpeg"/>
<description>
{{`<![CDATA[ ` | safeHTML }}
{{ if isset .Params "image" }}
{{ $cdnUrl := .Site.Params.blogCdnUrl }}
<p><img src="{{ $cdnUrl }}{{ with .Params.image }}{{.}}{{ end }}"/></p>{{end}}
{{ .Summary | safeHTML }}
]]>
</description>
</item>
<content:encoded>
{{`<![CDATA[ ` | safeHTML }}
<p><img src="{{ $cdnUrl }}{{ with .Params.image }}{{.}}{{ end }}"/></p>
{{ .Content | safeHTML }}
]]>
</content:encoded>
{{ else }}
{{ if isset .Params "image" }}
{{ $cdnUrl := .Site.Params.blogCdnUrl }}
{{ with .Params.image }}<enclosure url="{{ $cdnUrl }}{{ . }}" type="image/jpg"/>{{ end }}
{{ else }}
<enclosure url="https://gmgauthier.us-east-1.linodeobjects.com/blog/img/blue-gray-code.jpg" type="image/jpg"/>
{{ end }}
<description>
{{`<![CDATA[ ` | safeHTML }}
{{ $cdnUrl := .Site.Params.blogCdnUrl }}
{{ if isset .Params "image" }}<p><img src="{{ $cdnUrl }}{{ with .Params.image }}{{.}}{{ end }}"/></p>{{ end }}
{{ .Summary | safeHTML }}
]]>
</description>
{{ end }} <!-- IF ENCLOSURE / ELSE -->
</item>
{{ end }} <!-- RANGE -->
</channel>
</rss>