taxonomy: print term title even if not set in term frontmatter #701

This commit is contained in:
Sören Weber 2023-10-29 00:03:19 +02:00
parent 5c71fd84ba
commit e7ad33ddb6
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
11 changed files with 21 additions and 14 deletions

View file

@ -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.

View file

@ -0,0 +1,3 @@
+++
+++
{{< piratify true >}}

View file

@ -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" .))

View file

@ -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" .))

View file

@ -12,7 +12,7 @@
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
{{- $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 "" }}
</ul>
@ -29,7 +29,7 @@
{{- end }}
{{- end }}
{{- if $len }}
<li><a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .Page) }}">{{ .Page.Title }}</a> ({{ $len }})</li>
<li><a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .Page) }}">{{ (default .Page.Data.Term .Page.Title) }}</a> ({{ $len }})</li>
{{- end }}
{{- $lastCapital = $capital }}
{{- end }}

View file

@ -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) }}
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
{{- .Content }}
<ul class="columnize">

View file

@ -14,7 +14,7 @@
{{- $breadcrumb := slice }}
{{- range seq $depth }}
{{- if $to }}
{{- if $to.Title }}
{{- if (default $to.Data.Term $to.Title) }}
{{- $breadcrumb = $breadcrumb | append $to }}
{{- end }}
{{- else }}
@ -32,17 +32,17 @@
{{- $to := $e }}
{{- $depth = add $depth 1 }}
{{- $title := $to.Title }}
{{- if eq .Kind "taxonomy" }}
{{- if eq $to.Kind "taxonomy" }}
{{- $title = i18n $to.Data.Plural }}
{{- if not $title }}
{{- $title = $to.Data.Plural }}
{{- end }}
{{- else if eq .Kind "term" }}
{{- else if eq $to.Kind "term" }}
{{- $title = i18n $to.Data.Singular }}
{{- if not $title }}
{{- $title = $to.Data.Singular }}
{{- end }}
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) $to.Title }}
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (default $to.Data.Term $to.Title) }}
{{- end }}
{{- if not $title }}
{{- $title = $to.Site.Title }}

View file

@ -23,7 +23,7 @@
{{- if not $title }}
{{- $title = .Data.Singular }}
{{- end }}
{{- $title = printf "%s %s %s" .Title (default "::" .Site.Params.titleSeparator) $title }}
{{- $title = printf "%s %s %s" (default .Data.Term .Title) (default "::" .Site.Params.titleSeparator) $title }}
{{- end }}
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}

View file

@ -19,7 +19,7 @@
{{- if not $title }}
{{- $title = .Data.Singular }}
{{- end }}
{{- $title = printf "%s %s %s" .Title (default "::" .Site.Params.titleSeparator) $title }}
{{- $title = printf "%s %s %s" (default .Data.Term .Title) (default "::" .Site.Params.titleSeparator) $title }}
{{- end }}
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
@ -64,7 +64,7 @@
{{- if not $title }}
{{- $title = .Data.Singular }}
{{- end }}
{{- $title = printf "%s %s %s" .Title (default "::" .Site.Params.titleSeparator) $title }}
{{- $title = printf "%s %s %s" (default .Data.Term .Title) (default "::" .Site.Params.titleSeparator) $title }}
{{- end }}
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}

View file

@ -36,7 +36,7 @@
<ul>
{{- range $term_page := . }}
{{- $to := . }}
<li><a class="term-link" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }}">{{ $to.Title }}</a></li>
<li><a class="term-link" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }}">{{ default $to.Data.Term $to.Title }}</a></li>
{{- end }}
</ul>
</div>

View file

@ -15,7 +15,7 @@
{{- if not $title }}
{{- $title = .Data.Singular }}
{{- end }}
{{- $title = printf "%s %s %s" .Title (default "::" .Site.Params.titleSeparator) $title }}
{{- $title = printf "%s %s %s" (default .Data.Term .Title) (default "::" .Site.Params.titleSeparator) $title }}
{{- end }}
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}