Change feeds titles to be similar to page titles

master
Will Faught 5 months ago
parent aa1e152cfd
commit 96cbbf8a08

@ -17,18 +17,26 @@
{{ $subpages = first $limit $subpages }}
{{ end }}
{{ $titles := slice (markdownify $page.Title) }}
{{ $titles := slice }}
{{ range .Ancestors }}
{{ $titles = $titles | append (markdownify .Title) }}
{{ end }}
{{ if $page.IsHome }}
{{ $titles = slice (site.Title | default $page.Title | markdownify | plainify | htmlUnescape) }}
{{ else }}
{{ with $page.Title }}
{{ $titles = slice (. | markdownify | plainify | htmlUnescape) }}
{{ end }}
{{ $title := delimit $titles " · " }}
{{ range .Ancestors }}
{{ $title := cond .IsHome (site.Title | default .Title) .Title }}
{{ if not $title }}
{{ warnf "layouts/_default/list.atom.xml: Page %s does not have a title. The atom output requires a title. Either set the page's title parameter, or disable the atom output." $page.RelPermalink }}
{{ with $title }}
{{ $titles = $titles | append (. | markdownify | plainify | htmlUnescape) }}
{{ end }}
{{ end }}
{{ end }}
{{ $title := delimit $titles " · " }}
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\"?>" | safeHTML }}
<feed {{ with $language }} xml:lang="{{ . }}" {{ end }} xmlns="http://www.w3.org/2005/Atom">

@ -16,18 +16,26 @@
{{ $subpages = $subpages | first $limit }}
{{ end }}
{{ $titles := slice (markdownify $page.Title) }}
{{ $titles := slice }}
{{ range .Ancestors }}
{{ $titles = $titles | append (markdownify .Title) }}
{{ end }}
{{ if $page.IsHome }}
{{ $titles = slice (site.Title | default $page.Title | markdownify | plainify | htmlUnescape) }}
{{ else }}
{{ with $page.Title }}
{{ $titles = slice (. | markdownify | plainify | htmlUnescape) }}
{{ end }}
{{ $title := delimit $titles " · " }}
{{ range .Ancestors }}
{{ $title := cond .IsHome (site.Title | default .Title) .Title }}
{{ if not $title }}
{{ warnf "layouts/_default/list.rss.xml: Page %s does not have a title. The rss output requires a title. Either set the page's title parameter, or disable the rss output." $page.RelPermalink }}
{{ with $title }}
{{ $titles = $titles | append (. | markdownify | plainify | htmlUnescape) }}
{{ end }}
{{ end }}
{{ end }}
{{ $title := delimit $titles " · " }}
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\"?>" | safeHTML }}
<rss version="2.0" {{ with $language }} xml:lang="{{ . }}" {{ end }} xmlns:atom="http://www.w3.org/2005/Atom">

Loading…
Cancel
Save