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