From 926bea47272aaeca556b639ad4834f9b77df3d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Mon, 22 Jul 2024 00:15:38 +0200 Subject: [PATCH] title: avoid to much dependency on outputFormat #685 --- layouts/_default/index.search.js | 6 ++---- layouts/_default/rss.xml | 6 ++---- layouts/partials/header.html | 8 +++++--- layouts/partials/menu.html | 10 ++++++---- layouts/partials/opengraph.html | 16 +++++++++------- layouts/partials/pageHelper/taxonomyPages.html | 4 +--- layouts/partials/pageHelper/title.hugo | 7 +++++-- layouts/partials/schema.html | 10 ++++------ layouts/partials/term-list.html | 6 ++---- layouts/partials/topbar/button/next.html | 12 +++++++----- layouts/partials/topbar/button/prev.html | 13 +++++++------ 11 files changed, 50 insertions(+), 48 deletions(-) diff --git a/layouts/_default/index.search.js b/layouts/_default/index.search.js index 20d2eb296c..6a7291296c 100644 --- a/layouts/_default/index.search.js +++ b/layouts/_default/index.search.js @@ -1,16 +1,14 @@ {{- partialCached "page-meta.hugo" . .RelPermalink }} -{{- $format := partial "get-format.hugo" . }} -{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }} {{- $pages := slice }} {{- range .Site.Pages }} {{- if and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }} {{- $tags := slice }} {{- range .GetTerms "tags" }} - {{- $tags = $tags | append (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true "format" $format "outputFormat" $outputFormat) | plainify) }} + {{- $tags = $tags | append (partial "pageHelper/title.hugo" (dict "page" .Page "linkTitle" true) | plainify) }} {{- end }} {{- $pages = $pages | append (dict "uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .)) - "title" (partial "pageHelper/title.hugo" (dict "page" . "format" $format "outputFormat" $outputFormat) | plainify) + "title" (partial "pageHelper/title.hugo" (dict "page" .) | plainify) "tags" $tags "breadcrumb" (partial "breadcrumbs.html" (dict "page" . "dirOnly" true) | plainify | htmlUnescape | chomp) "description" (or .Description .Summary | plainify | htmlUnescape | chomp) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index ad7aa4ac4e..1a7a24805f 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -1,7 +1,5 @@ {{- /* based on Hugo 0.125.5 rss.xml */}} {{- partialCached "page-meta.hugo" . .RelPermalink }} -{{- $format := partial "get-format.hugo" . }} -{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }} {{- /* Deprecate site.Author.email in favor of site.Params.author.email */}} {{- $authorEmail := "" }} {{- if and .Site.Params.author (reflect.IsMap .Site.Params.author) .Site.Params.author.email }} @@ -29,7 +27,7 @@ {{- printf "" | safeHTML }} - {{ partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true "format" $format "outputFormat" $outputFormat) }} + {{ partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true) }} {{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }} {{ or .Description .Summary | plainify | htmlUnescape | chomp | transform.XMLEscape | safeHTML }} Hugo @@ -51,7 +49,7 @@ {{- end }} {{- if $visible }} - {{ partial "pageHelper/title.hugo" (dict "page" . "format" $format "outputFormat" $outputFormat) }} + {{ partial "pageHelper/title.hugo" (dict "page" .) }} {{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }} {{ (or .PublishDate .Date).Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} {{- with $authorEmail }}{{ . }}{{ with $authorName }} ({{ . }}){{ end }}{{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index ff6b1f8a34..384393beba 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -2,8 +2,10 @@ {{- $format := partial "get-format.hugo" . }} {{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }} {{- $basename := "index" }} -{{- if eq $outputFormat "searchpage" }} - {{- $basename = partial "BaseName.hugo" $format.RelPermalink }} +{{- if eq .Kind "home" }} + {{- if eq $outputFormat "searchpage" }} + {{- $basename = partial "BaseName.hugo" $format.RelPermalink }} + {{- end }} {{- end }} {{- if eq . .Site.Sites.First.Home }} {{- $hugoVersion := "0.121.0" }} @@ -19,7 +21,7 @@ {{- partial "meta.html" . }} {{- $page := . }} {{- $link := "" }} - {{- $title := partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true "format" $format "outputFormat" $outputFormat) }} + {{- $title := partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true) }} {{ $title }} {{- if .IsTranslated -}} diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index 5adc8e5d40..d2d42fff15 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -1,10 +1,12 @@ {{- $showvisitedlinks := .Site.Params.showVisitedLinks }} - {{- $format := partial "get-format.hugo" . }} - {{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }} {{- $basename := "index" }} - {{- if eq $outputFormat "searchpage" }} - {{- $basename = partial "BaseName.hugo" $format.RelPermalink }} + {{- if eq .Kind "home" }} + {{- $format := partial "get-format.hugo" . }} + {{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }} + {{- if eq $outputFormat "searchpage" }} + {{- $basename = partial "BaseName.hugo" $format.RelPermalink }} + {{- end }} {{- end }}