From e7ad33ddb6c0d6a254104c4fa94bc537955af0ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sun, 29 Oct 2023 00:03:19 +0200 Subject: [PATCH] taxonomy: print term title even if not set in term frontmatter #701 --- exampleSite/content/tags/hidden/_index.en.md | 4 ++++ exampleSite/content/tags/hidden/_index.pir.md | 3 +++ layouts/_default/index.json | 2 +- layouts/_default/index.search.js | 2 +- layouts/_default/taxonomy.html | 4 ++-- layouts/_default/term.html | 2 +- layouts/partials/breadcrumbs.html | 8 ++++---- layouts/partials/header.html | 2 +- layouts/partials/opengraph.html | 4 ++-- layouts/partials/term-list.html | 2 +- layouts/partials/twitter_cards.html | 2 +- 11 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 exampleSite/content/tags/hidden/_index.en.md create mode 100644 exampleSite/content/tags/hidden/_index.pir.md diff --git a/exampleSite/content/tags/hidden/_index.en.md b/exampleSite/content/tags/hidden/_index.en.md new file mode 100644 index 0000000000..d9fa9f085d --- /dev/null +++ b/exampleSite/content/tags/hidden/_index.en.md @@ -0,0 +1,4 @@ ++++ ++++ + +This lists all pages that are hidden from the home page. This includes pages that define `hidden=true` in their frontmatter as weill as descendents of hidden pages. \ No newline at end of file diff --git a/exampleSite/content/tags/hidden/_index.pir.md b/exampleSite/content/tags/hidden/_index.pir.md new file mode 100644 index 0000000000..89bf7c45e9 --- /dev/null +++ b/exampleSite/content/tags/hidden/_index.pir.md @@ -0,0 +1,3 @@ ++++ ++++ +{{< piratify true >}} \ No newline at end of file diff --git a/layouts/_default/index.json b/layouts/_default/index.json index abd89e5696..3e401ff788 100644 --- a/layouts/_default/index.json +++ b/layouts/_default/index.json @@ -13,7 +13,7 @@ {{- if not $title }} {{- $title = .Data.Singular }} {{- end }} - {{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Title }} + {{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (default .Data.Term .Title) }} {{- end }} {{- $pages = $pages | append (dict "uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .)) diff --git a/layouts/_default/index.search.js b/layouts/_default/index.search.js index aaea2ab9dd..a542caceb3 100644 --- a/layouts/_default/index.search.js +++ b/layouts/_default/index.search.js @@ -13,7 +13,7 @@ {{- if not $title }} {{- $title = .Data.Singular }} {{- end }} - {{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Title }} + {{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (default .Data.Term .Title) }} {{- end }} {{- $pages = $pages | append (dict "uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .)) diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index ef47290246..db5fced60d 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -12,7 +12,7 @@

{{ $title }}

{{- $lastCapital := "" }} {{- range .Data.Terms.Alphabetical }} - {{- $capital := substr .Page.Title 0 1 | upper }} + {{- $capital := substr (default .Page.Data.Term .Page.Title) 0 1 | upper }} {{- if ne $lastCapital $capital }} {{- if ne $lastCapital "" }} @@ -29,7 +29,7 @@ {{- end }} {{- end }} {{- if $len }} -
  • {{ .Page.Title }} ({{ $len }})
  • +
  • {{ (default .Page.Data.Term .Page.Title) }} ({{ $len }})
  • {{- end }} {{- $lastCapital = $capital }} {{- end }} diff --git a/layouts/_default/term.html b/layouts/_default/term.html index 68d4a58d31..ab2ab250e5 100644 --- a/layouts/_default/term.html +++ b/layouts/_default/term.html @@ -9,7 +9,7 @@ {{- if not $title }} {{- $title = .Data.Singular }} {{- end }} -{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Title }} +{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (default .Data.Term .Title) }}

    {{ $title }}

    {{- .Content }}