mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
taxonomy: humanize term on missing term title #713
This commit is contained in:
parent
af5ff17178
commit
7d676d80d4
10 changed files with 15 additions and 12 deletions
|
@ -8,7 +8,7 @@
|
||||||
{{- else if eq .Kind "term" }}
|
{{- else if eq .Kind "term" }}
|
||||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
{{- $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 = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (default (humanize .Data.Term) .Title) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $pages = $pages | append (dict
|
{{- $pages = $pages | append (dict
|
||||||
"uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .))
|
"uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .))
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{{- else if eq .Kind "term" }}
|
{{- else if eq .Kind "term" }}
|
||||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
{{- $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 = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (default (humanize .Data.Term) .Title) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $pages = $pages | append (dict
|
{{- $pages = $pages | append (dict
|
||||||
"uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .))
|
"uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .))
|
||||||
|
|
|
@ -19,7 +19,10 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if $len }}
|
{{- if $len }}
|
||||||
{{- $pages = $pages| append (dict "Title" (default .Page.Data.Term .Page.Title) "Page" . "Len" $len )}}
|
{{- $pages = $pages| append (dict "Title" (default (humanize .Page.Data.Term) .Page.Title) "Page" . "Len" $len )}}
|
||||||
|
{{- end }}
|
||||||
|
{{- if not .Page.Title }}
|
||||||
|
{{- warnf "%q: You have not given a 'title' in the frontmatter of your term page, the humanized term will be used instead" .Page.File.Filename }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- range sort $pages ".Title" }}
|
{{- range sort $pages ".Title" }}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||||
{{- $title := default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
{{- $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 = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) (default (humanize .Data.Term) .Title) }}
|
||||||
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
|
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
|
||||||
{{- .Content }}
|
{{- .Content }}
|
||||||
{{- $lastCapital := "" }}
|
{{- $lastCapital := "" }}
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
{{- else if eq $to.Kind "term" }}
|
{{- else if eq $to.Kind "term" }}
|
||||||
{{- $taxonomy_page := $to.Site.GetPage $to.Data.Plural }}
|
{{- $taxonomy_page := $to.Site.GetPage $to.Data.Plural }}
|
||||||
{{- $title = default (default $to.Data.Singular (i18n $to.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
{{- $title = default (default $to.Data.Singular (i18n $to.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||||
{{- $title = printf "%s %s %s" $title (default "::" $to.Site.Params.titleSeparator) (default $to.Data.Term $to.Title) }}
|
{{- $title = printf "%s %s %s" $title (default "::" $to.Site.Params.titleSeparator) (default (humanize $to.Data.Term) $to.Title) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if not $title }}
|
{{- if not $title }}
|
||||||
{{- $title = $to.Site.Title }}
|
{{- $title = $to.Site.Title }}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
{{- else if eq .Kind "term" }}
|
{{- else if eq .Kind "term" }}
|
||||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
{{- $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 }}
|
{{- $title = printf "%s %s %s" (default (humanize .Data.Term) .Title) (default "::" .Site.Params.titleSeparator) $title }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
|
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
|
||||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
|
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
{{- else if eq .Kind "term" }}
|
{{- else if eq .Kind "term" }}
|
||||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
{{- $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 }}
|
{{- $title = printf "%s %s %s" (default (humanize .Data.Term) .Title) (default "::" .Site.Params.titleSeparator) $title }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
|
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
|
||||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
|
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
{{- else if eq .Kind "term" }}
|
{{- else if eq .Kind "term" }}
|
||||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
{{- $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 }}
|
{{- $title = printf "%s %s %s" (default (humanize .Data.Term) .Title) (default "::" .Site.Params.titleSeparator) $title }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
|
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
|
||||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
|
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $term_key := ($term | plainify | anchorize) }}
|
{{- $term_key := ($term | plainify | anchorize) }}
|
||||||
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
|
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
|
||||||
{{- $term_pages = $term_pages | append (dict "Title" (default .Data.Term .Title) "Term" . )}}
|
{{- $term_pages = $term_pages | append (dict "Title" (default (humanize .Data.Term) .Title) "Term" . )}}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- $term_key = ($term | urlize) }}
|
{{- $term_key = ($term | urlize) }}
|
||||||
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
|
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
|
||||||
{{- $term_pages = $term_pages | append (dict "Title" (default .Data.Term .Title) "Term" . )}}
|
{{- $term_pages = $term_pages | append (dict "Title" (default (humanize .Data.Term) .Title) "Term" . )}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if $len }}
|
{{- if $len }}
|
||||||
{{- $pages = $pages| append (dict "Title" (default .Page.Data.Term .Page.Title) "Page" . "Len" $len )}}
|
{{- $pages = $pages| append (dict "Title" (default (humanize .Page.Data.Term) .Page.Title) "Page" . "Len" $len )}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- else if eq .Kind "term" }}
|
{{- else if eq .Kind "term" }}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
{{- else if eq .Kind "term" }}
|
{{- else if eq .Kind "term" }}
|
||||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||||
{{- $title = default (default .Data.Singular (i18n .Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
{{- $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 }}
|
{{- $title = printf "%s %s %s" (default (humanize .Data.Term) .Title) (default "::" .Site.Params.titleSeparator) $title }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
|
{{- if and $title .Site.Title (not (eq $title .Site.Title)) }}
|
||||||
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
|
{{- $title = printf "%s %s %s" $title (default "::" .Site.Params.titleSeparator) .Site.Title }}
|
||||||
|
|
Loading…
Reference in a new issue