mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
taxonomy: lookup title from overridden taxonomy page #712
This commit is contained in:
parent
4ebb6d9eac
commit
34b8804977
11 changed files with 39 additions and 65 deletions
8
exampleSite/content/tags/_index.en.md
Normal file
8
exampleSite/content/tags/_index.en.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
+++
|
||||
+++
|
||||
|
||||
You can define optional content in your overridden taxonomy page. Aswell you can define optional `title` and `singulartitle` that will override the values from your `config.toml` or of your translation files.
|
||||
|
||||
## Just an example heading
|
||||
|
||||
The TOC will contain this heading and the index headings below.
|
5
exampleSite/content/tags/_index.pir.md
Normal file
5
exampleSite/content/tags/_index.pir.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
+++
|
||||
title = "Tag-a-taggs"
|
||||
singulartitle = "Tagga"
|
||||
+++
|
||||
{{< piratify >}}
|
|
@ -4,15 +4,10 @@
|
|||
{{- if and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }}
|
||||
{{- $title := .Title }}
|
||||
{{- if eq .Kind "taxonomy" }}
|
||||
{{- $title = i18n .Data.Plural }}
|
||||
{{- if not $title }}
|
||||
{{- $title = .Data.Plural }}
|
||||
{{- end }}
|
||||
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Title }}
|
||||
{{- else if eq .Kind "term" }}
|
||||
{{- $title = i18n .Data.Singular }}
|
||||
{{- if not $title }}
|
||||
{{- $title = .Data.Singular }}
|
||||
{{- end }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (default .Data.Term .Title) }}
|
||||
{{- end }}
|
||||
{{- $pages = $pages | append (dict
|
||||
|
|
|
@ -4,15 +4,10 @@
|
|||
{{- if and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }}
|
||||
{{- $title := .Title }}
|
||||
{{- if eq .Kind "taxonomy" }}
|
||||
{{- $title = i18n .Data.Plural }}
|
||||
{{- if not $title }}
|
||||
{{- $title = .Data.Plural }}
|
||||
{{- end }}
|
||||
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Title }}
|
||||
{{- else if eq .Kind "term" }}
|
||||
{{- $title = i18n .Data.Singular }}
|
||||
{{- if not $title }}
|
||||
{{- $title = .Data.Singular }}
|
||||
{{- end }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (default .Data.Term .Title) }}
|
||||
{{- end }}
|
||||
{{- $pages = $pages | append (dict
|
||||
|
|
|
@ -5,10 +5,7 @@
|
|||
</header>
|
||||
{{- $page := . }}
|
||||
|
||||
{{- $title := i18n .Data.Plural }}
|
||||
{{- if not $title }}
|
||||
{{- $title = .Data.Plural }}
|
||||
{{- end }}
|
||||
{{- $title := default (default .Data.Plural (i18n .Data.Plural)) .Title }}
|
||||
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
|
||||
{{- $lastCapital := "" }}
|
||||
{{- $terms := slice }}
|
||||
|
|
|
@ -5,10 +5,8 @@
|
|||
</header>
|
||||
{{- $page := . }}
|
||||
|
||||
{{- $title := i18n .Data.Singular }}
|
||||
{{- if not $title }}
|
||||
{{- $title = .Data.Singular }}
|
||||
{{- end }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $title := default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (default .Data.Term .Title) }}
|
||||
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
|
||||
{{- .Content }}
|
||||
|
|
|
@ -33,15 +33,10 @@
|
|||
{{- $depth = add $depth 1 }}
|
||||
{{- $title := $to.Title }}
|
||||
{{- if eq $to.Kind "taxonomy" }}
|
||||
{{- $title = i18n $to.Data.Plural }}
|
||||
{{- if not $title }}
|
||||
{{- $title = $to.Data.Plural }}
|
||||
{{- end }}
|
||||
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Title }}
|
||||
{{- else if eq $to.Kind "term" }}
|
||||
{{- $title = i18n $to.Data.Singular }}
|
||||
{{- if not $title }}
|
||||
{{- $title = $to.Data.Singular }}
|
||||
{{- end }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (default $to.Data.Term $to.Title) }}
|
||||
{{- end }}
|
||||
{{- if not $title }}
|
||||
|
|
|
@ -14,15 +14,10 @@
|
|||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $title = T "Search" }}
|
||||
{{- else if eq .Kind "taxonomy" }}
|
||||
{{- $title = i18n .Data.Plural }}
|
||||
{{- if not $title }}
|
||||
{{- $title = .Data.Plural }}
|
||||
{{- end }}
|
||||
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Title }}
|
||||
{{- else if eq .Kind "term" }}
|
||||
{{- $title = i18n .Data.Singular }}
|
||||
{{- if not $title }}
|
||||
{{- $title = .Data.Singular }}
|
||||
{{- end }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $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)) }}
|
||||
|
|
|
@ -10,15 +10,10 @@
|
|||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $title = T "Search" }}
|
||||
{{- else if eq .Kind "taxonomy" }}
|
||||
{{- $title = i18n .Data.Plural }}
|
||||
{{- if not $title }}
|
||||
{{- $title = .Data.Plural }}
|
||||
{{- end }}
|
||||
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Title }}
|
||||
{{- else if eq .Kind "term" }}
|
||||
{{- $title = i18n .Data.Singular }}
|
||||
{{- if not $title }}
|
||||
{{- $title = .Data.Singular }}
|
||||
{{- end }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $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)) }}
|
||||
|
@ -55,15 +50,10 @@
|
|||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $title = T "Search" }}
|
||||
{{- else if eq .Kind "taxonomy" }}
|
||||
{{- $title = i18n .Data.Plural }}
|
||||
{{- if not $title }}
|
||||
{{- $title = .Data.Plural }}
|
||||
{{- end }}
|
||||
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Title }}
|
||||
{{- else if eq .Kind "term" }}
|
||||
{{- $title = i18n .Data.Singular }}
|
||||
{{- if not $title }}
|
||||
{{- $title = .Data.Singular }}
|
||||
{{- end }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $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)) }}
|
||||
|
|
|
@ -29,8 +29,9 @@
|
|||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $taxonomy_title := default (default $taxonomy_page.Data.Plural (i18n $taxonomy_page.Data.Plural)) $taxonomy_page.Title }}
|
||||
{{- with $term_pages }}
|
||||
<div class=" taxonomy-{{ $taxonomy }} term-list cstyle {{ $style }} {{ $class }}" title="{{ $taxonomy_page.Title }}"{{ if $color }}{{ printf " style=\"--VARIABLE-TAGS-BG-color: %s;\"" $color | safeHTMLAttr }}{{ end }}>
|
||||
<div class=" taxonomy-{{ $taxonomy }} term-list cstyle {{ $style }} {{ $class }}" title="{{ $taxonomy_title }}"{{ if $color }}{{ printf " style=\"--VARIABLE-TAGS-BG-color: %s;\"" $color | safeHTMLAttr }}{{ end }}>
|
||||
{{- if $icon }}
|
||||
<i class="{{ $icon }}"></i>
|
||||
{{- end }}
|
||||
|
|
|
@ -6,15 +6,10 @@
|
|||
{{- if eq $outputFormat "searchpage" }}
|
||||
{{- $title = T "Search" }}
|
||||
{{- else if eq .Kind "taxonomy" }}
|
||||
{{- $title = i18n .Data.Plural }}
|
||||
{{- if not $title }}
|
||||
{{- $title = .Data.Plural }}
|
||||
{{- end }}
|
||||
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Title }}
|
||||
{{- else if eq .Kind "term" }}
|
||||
{{- $title = i18n .Data.Singular }}
|
||||
{{- if not $title }}
|
||||
{{- $title = .Data.Singular }}
|
||||
{{- end }}
|
||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||
{{- $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)) }}
|
||||
|
|
Loading…
Reference in a new issue