diff --git a/exampleSite/content/tags/_index.en.md b/exampleSite/content/tags/_index.en.md new file mode 100644 index 0000000000..7f878e278a --- /dev/null +++ b/exampleSite/content/tags/_index.en.md @@ -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. \ No newline at end of file diff --git a/exampleSite/content/tags/_index.pir.md b/exampleSite/content/tags/_index.pir.md new file mode 100644 index 0000000000..c8236e790d --- /dev/null +++ b/exampleSite/content/tags/_index.pir.md @@ -0,0 +1,5 @@ ++++ +title = "Tag-a-taggs" +singulartitle = "Tagga" ++++ +{{< piratify >}} \ No newline at end of file diff --git a/layouts/_default/index.json b/layouts/_default/index.json index 3e401ff788..c4d663a17b 100644 --- a/layouts/_default/index.json +++ b/layouts/_default/index.json @@ -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 diff --git a/layouts/_default/index.search.js b/layouts/_default/index.search.js index a542caceb3..a8dac2e8b3 100644 --- a/layouts/_default/index.search.js +++ b/layouts/_default/index.search.js @@ -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 diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index b0895b4df1..cd8c849f8e 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -5,10 +5,7 @@ {{- $page := . }} -{{- $title := i18n .Data.Plural }} -{{- if not $title }} - {{- $title = .Data.Plural }} -{{- end }} +{{- $title := default (default .Data.Plural (i18n .Data.Plural)) .Title }}

{{ $title }}

{{- $lastCapital := "" }} {{- $terms := slice }} diff --git a/layouts/_default/term.html b/layouts/_default/term.html index 6c03f60156..60a4d327c6 100644 --- a/layouts/_default/term.html +++ b/layouts/_default/term.html @@ -5,10 +5,8 @@ {{- $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) }}

{{ $title }}

{{- .Content }} diff --git a/layouts/partials/breadcrumbs.html b/layouts/partials/breadcrumbs.html index 34a18bfa8b..b088c8d556 100644 --- a/layouts/partials/breadcrumbs.html +++ b/layouts/partials/breadcrumbs.html @@ -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 }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 3f01ddc607..1124851157 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -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)) }} diff --git a/layouts/partials/opengraph.html b/layouts/partials/opengraph.html index 9fd7b3e01b..5906747fd7 100644 --- a/layouts/partials/opengraph.html +++ b/layouts/partials/opengraph.html @@ -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)) }} diff --git a/layouts/partials/term-list.html b/layouts/partials/term-list.html index ca32835fa2..4214f16518 100644 --- a/layouts/partials/term-list.html +++ b/layouts/partials/term-list.html @@ -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 }} -
+
{{- if $icon }} {{- end }} diff --git a/layouts/partials/twitter_cards.html b/layouts/partials/twitter_cards.html index 499caa775e..e71c05b53a 100644 --- a/layouts/partials/twitter_cards.html +++ b/layouts/partials/twitter_cards.html @@ -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)) }}