second attempt at RSS

This commit is contained in:
Greg Gauthier 2023-01-25 14:21:58 +00:00
parent 18b4f9d678
commit b3ca054e39
2 changed files with 28 additions and 40 deletions

View File

@ -11,6 +11,12 @@ enableInlineShortcodes = true
enableGitInfo = true enableGitInfo = true
canonifyurls = true canonifyurls = true
[frontmatter]
date = ["date", "publishDate", "lastmod"]
lastmod = [":fileModTime", "lastmod", ":git", "publishDate"]
publishDate = ["publishDate", "date"]
expiryDate = ["expiryDate"]
[markup] [markup]
[markup.goldmark.renderer] [markup.goldmark.renderer]
unsafe= true unsafe= true

View File

@ -34,53 +34,35 @@
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end -}} {{- end -}}
{{ range $pages }} {{ range $pages }}
{{ if or (eq .Title "Links") (eq .Title "Videos") }}<!-- do nothing -->
{{else}}
<item> <item>
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<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>
<!-- *** THE ENCLOSURE PARAMETER WILL BE TREATED AS A SIGNAL THAT THIS IS A PODCAST *** --> {{ if isset .Params "image" }}
{{ if isset .Params "enclosure" }} {{ with .Params.image }}
{{ $cdnUrl := .Site.Params.podcastCdnUrl }} <enclosure url="{{ $.Site.Params.blogCdnUrl }}{{ . }}" type="image/jpg"/>
<category>Podcast: {{.Params.series }}</category> {{ end }}
<enclosure url="{{$cdnUrl}}{{.Params.enclosure}}" type="audio/mpeg"/> {{ end }}
<description>
{{`<![CDATA[ ` | safeHTML }} <description>
{{ if isset .Params "image" }} {{`<![CDATA[ ` | safeHTML }}
<p><img src="{{ $cdnUrl }}{{ with .Params.image }}{{.}}{{ end }}"/></p>{{end}} {{ if isset .Params "image" }}<p><img src="{{ $.Site.Params.blogCdnUrl }}{{ with .Params.image }}{{.}}{{ end }}"/></p>{{end}}
{{ .Summary | safeHTML }} {{ .Summary | safeHTML }}
]]> ]]>
</description> </description>
<content:encoded> <content:encoded>
{{`<![CDATA[ ` | safeHTML }} {{`<![CDATA[ ` | safeHTML }}
<p><img src="{{ $cdnUrl }}{{ with .Params.image }}{{.}}{{ end }}"/></p> {{ if isset .Params "image" }}
{{ .Content | safeHTML }}
]]>
</content:encoded>
{{ else }}
{{ if isset .Params "topic" }}<category>Reading: {{ .Params.topic }}</category>
{{else}}
<category>Blog: {{.Params.topics }}</category>
{{ end }}
{{ if isset .Params "image" }}
{{ $cdnUrl := .Site.Params.blogCdnUrl }} {{ $cdnUrl := .Site.Params.blogCdnUrl }}
{{ with .Params.image }}<enclosure url="{{ $cdnUrl }}{{ . }}" type="image/jpg"/>{{ end }} <p><img src="{{ $cdnUrl }}{{ with .Params.image }}{{.}}{{ end }}"/></p>
{{ else }} {{end}}
<enclosure url="https://gmgauthier.us-east-1.linodeobjects.com/blog/img/blue-gray-code.jpg" type="image/jpg"/> {{ .Content | safeHTML }}
{{ end }} ]]>
<description> </content:encoded>
{{`<![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 }} <!-- if contact or about --> {{ end }}
{{ end }} <!-- RANGE -->
</channel> </channel>
</rss> </rss>