From c11344d0bed9b64c00f26a220f6244d07813e6a8 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Sun, 24 Sep 2023 21:57:22 -0700 Subject: [PATCH] Change feed, HTML titles to have breadcrumbs --- layouts/_default/list.atom.xml | 21 +++++++++------------ layouts/_default/rss.xml | 21 +++++++++------------ layouts/partials/paige/head.html | 20 ++++++-------------- 3 files changed, 24 insertions(+), 38 deletions(-) diff --git a/layouts/_default/list.atom.xml b/layouts/_default/list.atom.xml index ff35e38b..f0e266c8 100644 --- a/layouts/_default/list.atom.xml +++ b/layouts/_default/list.atom.xml @@ -14,7 +14,6 @@ {{ $sitetitle := site.Title | markdownify }} {{ $subpages := slice }} {{ $subtitle := $page.Description | markdownify }} -{{ $title := "" }} {{ $updated := site.LastChange.Format $format }} {{ if $page.Params.id }} @@ -35,17 +34,15 @@ {{ $subpages = $subpages | first $limit }} {{ end }} -{{ if and $pagetitle $sitetitle }} - {{ if $page.IsHome }} - {{ $title = $pagetitle }} - {{ else }} - {{ $title = printf "%s · %s" $pagetitle $sitetitle }} - {{ end }} -{{ else if $pagetitle }} - {{ $title = $pagetitle }} -{{ else if $sitetitle }} - {{ $title = $sitetitle }} -{{ else }} +{{ $titles := slice ($page.Title | markdownify) }} + +{{ range .Ancestors }} + {{ $titles = $titles | append (.Title | markdownify) }} +{{ end }} + +{{ $title := delimit $titles " · " }} + +{{ if not $title }} {{ warnf "layouts/_default/list.atom.xml: page %s does not have a title" $page.RelPermalink }} {{ end }} diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 055334fd..024653d9 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -13,7 +13,6 @@ {{ $pagetitle := $page.Title | markdownify | plainify }} {{ $sitetitle := site.Title | markdownify | plainify }} {{ $subpages := slice }} -{{ $title := "" }} {{ $webmaster := $page.Param "paige.feed.rss.web_master" }} {{ range (cond $page.IsHome site $page).RegularPages }} @@ -26,17 +25,15 @@ {{ $subpages = $subpages | first $limit }} {{ end }} -{{ if and $pagetitle $sitetitle }} - {{ if $page.IsHome }} - {{ $title = $pagetitle }} - {{ else }} - {{ $title = printf "%s · %s" $pagetitle $sitetitle }} - {{ end }} -{{ else if $pagetitle }} - {{ $title = $pagetitle }} -{{ else if $sitetitle }} - {{ $title = $sitetitle }} -{{ else }} +{{ $titles := slice ($page.Title | markdownify) }} + +{{ range .Ancestors }} + {{ $titles = $titles | append (.Title | markdownify) }} +{{ end }} + +{{ $title := delimit $titles " · " }} + +{{ if not $title }} {{ warnf "layouts/_default/rss.xml: page %s does not have a title" $page.RelPermalink }} {{ end }} diff --git a/layouts/partials/paige/head.html b/layouts/partials/paige/head.html index c7d9164b..a0360be9 100644 --- a/layouts/partials/paige/head.html +++ b/layouts/partials/paige/head.html @@ -1,21 +1,13 @@ {{ $page := . }} -{{ $pagetitle := $page.Title | markdownify | plainify }} -{{ $sitetitle := site.Title | markdownify | plainify }} -{{ $title := "" }} - -{{ if and $pagetitle $sitetitle }} - {{ if $page.IsHome }} - {{ $title = $pagetitle }} - {{ else }} - {{ $title = printf "%s · %s" $pagetitle $sitetitle }} - {{ end }} -{{ else if $pagetitle }} - {{ $title = $pagetitle }} -{{ else if $sitetitle }} - {{ $title = $sitetitle }} +{{ $titles := slice ($page.Title | markdownify | plainify) }} + +{{ range .Ancestors }} + {{ $titles = $titles | append (.Title | markdownify | plainify) }} {{ end }} +{{ $title := delimit $titles " · " }} + {{ if templates.Exists "partials/paige/head-first.html" }} {{ partial "paige/head-first.html" $page }}