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
canonifyurls = true
[frontmatter]
date = ["date", "publishDate", "lastmod"]
lastmod = [":fileModTime", "lastmod", ":git", "publishDate"]
publishDate = ["publishDate", "date"]
expiryDate = ["expiryDate"]
[markup]
[markup.goldmark.renderer]
unsafe= true

View File

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