diff --git a/layouts/partials/topbar/button/next.html b/layouts/partials/topbar/button/next.html index 1bf09e9325..276290588e 100644 --- a/layouts/partials/topbar/button/next.html +++ b/layouts/partials/topbar/button/next.html @@ -11,18 +11,29 @@ {{- $endarrow = "🡐" }} {{- end }} {{- $next := "" }} + {{- $nextTitle := .Title }} {{- if eq .Page.Kind "taxonomy" }} {{- /* go to first term page */}} {{- $pages := partialCached "partials/pageHelper/taxonomyPages.html" . . }} {{- $next = (index $pages 0).Page }} + {{- if $next }} + {{- $taxonomy_page := .Page }} + {{- $nextTitle = default (default $next.Data.Singular (i18n $next.Data.Singular)) $taxonomy_page.Params.SingularTitle }} + {{- $nextTitle = printf "%s %s %s" $nextTitle (default "::" $next.Site.Params.titleSeparator) (default (humanize $next.Data.Term | strings.Title) $next.Title) }} + {{- end }} {{- else if eq .Page.Kind "term" }} {{- /* go to next term page */}} {{- $taxonomy_page := .Site.GetPage .Data.Plural }} {{- $pages := partialCached "partials/pageHelper/taxonomyPages.html" $taxonomy_page $taxonomy_page }} {{- $next = partial "partials/pageHelper/next.html" (dict "collection" $pages "item" .) }} + {{- if $next }} + {{- $nextTitle = default (default $next.Data.Singular (i18n $next.Data.Singular)) $taxonomy_page.Params.SingularTitle }} + {{- $nextTitle = printf "%s %s %s" $nextTitle (default "::" $next.Site.Params.titleSeparator) (default (humanize $next.Data.Term | strings.Title) $next.Title) }} + {{- end }} {{- else if or (ne $outputFormat "html") (not (.Scratch.Get "relearnNextPage")) }} {{- else }} {{- $next = .Scratch.Get "relearnNextPage" }} + {{- $nextTitle = $next.Title }} {{- end }} {{- partial "topbar/func/button.html" (dict "page" . @@ -32,7 +43,7 @@ "onwidths" $onwidths "onwidthm" $onwidthm "onwidthl" $onwidthl - "hint" (printf "%s (%s)" ($next | default .).Title ($endarrow | safeHTML)) + "hint" (printf "%s (%s)" $nextTitle ($endarrow | safeHTML)) )}} {{- end }} {{- end }} \ No newline at end of file diff --git a/layouts/partials/topbar/button/prev.html b/layouts/partials/topbar/button/prev.html index 12a4e55729..3e33f6d269 100644 --- a/layouts/partials/topbar/button/prev.html +++ b/layouts/partials/topbar/button/prev.html @@ -11,9 +11,11 @@ {{- $startarrow = "🡒" }} {{- end }} {{- $prev := "" }} + {{- $prevTitle := .Title }} {{- if and (eq .RelPermalink .Site.Home.RelPermalink) (eq $outputFormat "html") }} {{- else if eq .Page.Kind "taxonomy" }} {{- $prev = .Site.Home }} + {{- $prevTitle = $prev.Title }} {{- else if eq .Page.Kind "term" }} {{- /* go to previous term page or taxonomy page if it is the first term */}} {{- $taxonomy_page := .Site.GetPage .Data.Plural }} @@ -21,11 +23,17 @@ {{- $prev = partial "partials/pageHelper/prev.html" (dict "collection" $pages "item" .) }} {{- if not $prev }} {{- $prev = $taxonomy_page }} + {{- $prevTitle = default (default $prev.Data.Plural (i18n $prev.Data.Plural)) $prev.Params.Title }} + {{- else }} + {{- $prevTitle = default (default $prev.Data.Singular (i18n $prev.Data.Singular)) $taxonomy_page.Params.SingularTitle }} + {{- $prevTitle = printf "%s %s %s" $prevTitle (default "::" $prev.Site.Params.titleSeparator) (default (humanize $prev.Data.Term | strings.Title) $prev.Title) }} {{- end }} {{- else if or (ne $outputFormat "html") (not (.Scratch.Get "relearnPrevPage")) }} {{- $prev = .Site.Home }} + {{- $prevTitle = $prev.Title }} {{- else }} {{- $prev = .Scratch.Get "relearnPrevPage" }} + {{- $prevTitle = $prev.Title }} {{- end}} {{- partial "topbar/func/button.html" (dict "page" . @@ -35,7 +43,7 @@ "onwidths" $onwidths "onwidthm" $onwidthm "onwidthl" $onwidthl - "hint" (printf "%s (%s)" ($prev | default .).Title ($startarrow | safeHTML)) + "hint" (printf "%s (%s)" $prevTitle ($startarrow | safeHTML)) )}} {{- end }} {{- end }} \ No newline at end of file