Change feeds titles to be similar to page titles

This commit is contained in:
Will Faught
2025-02-13 23:35:20 -08:00
parent aa1e152cfd
commit 96cbbf8a08
2 changed files with 30 additions and 14 deletions

View File

@@ -17,18 +17,26 @@
{{ $subpages = first $limit $subpages }}
{{ end }}
{{ $titles := slice (markdownify $page.Title) }}
{{ $titles := slice }}
{{ range .Ancestors }}
{{ $titles = $titles | append (markdownify .Title) }}
{{ if $page.IsHome }}
{{ $titles = slice (site.Title | default $page.Title | markdownify | plainify | htmlUnescape) }}
{{ else }}
{{ with $page.Title }}
{{ $titles = slice (. | markdownify | plainify | htmlUnescape) }}
{{ end }}
{{ range .Ancestors }}
{{ $title := cond .IsHome (site.Title | default .Title) .Title }}
{{ with $title }}
{{ $titles = $titles | append (. | markdownify | plainify | htmlUnescape) }}
{{ end }}
{{ end }}
{{ end }}
{{ $title := delimit $titles " · " }}
{{ 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 }}
{{ end }}
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\"?>" | safeHTML }}
<feed {{ with $language }} xml:lang="{{ . }}" {{ end }} xmlns="http://www.w3.org/2005/Atom">