mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-30 03:03:09 +00:00
39 lines
No EOL
1.7 KiB
Go Template
39 lines
No EOL
1.7 KiB
Go Template
{{- $title := "" }}
|
|
{{- with .page }}
|
|
{{- if .Params.menuTitle }}
|
|
{{- warnf "%q: UNSUPPORTED frontmatter 'menutitle' found, use 'linktitle' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/6/#6-0-0" $.File.Filename }}
|
|
{{- end }}
|
|
{{- $siteTitle := site.Title }}
|
|
{{- $title = .Title }}
|
|
{{- if $.linkTitle }}
|
|
{{- $title = or .LinkTitle $title }}
|
|
{{- end }}
|
|
|
|
{{- if eq .Kind "home" }}
|
|
{{- $title = $title | default $siteTitle }}
|
|
{{- else if eq .Kind "taxonomy" }}
|
|
{{- $title = default (default .Data.Plural (i18n .Data.Plural)) .Params.Title }}
|
|
{{- else if eq .Kind "term" }}
|
|
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
|
{{- $taxonomy_title := default (default $taxonomy_page.Data.Singular (i18n $taxonomy_page.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
|
{{- $term_title := default (humanize .Data.Term | strings.Title) .Title }}
|
|
{{- if $.linkTitle }}
|
|
{{- $title = printf "%s" $term_title }}
|
|
{{- else if $.reverse }}
|
|
{{- $title = printf "%s %s %s" $term_title (default "::" .Site.Params.titleSeparator) $taxonomy_title }}
|
|
{{- else }}
|
|
{{- $title = printf "%s %s %s" $taxonomy_title (default "::" .Site.Params.titleSeparator) $term_title }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- if $.fullyQualified }}
|
|
{{- if and $title $siteTitle (not (eq $title $siteTitle)) }}
|
|
{{- if $.reverse }}
|
|
{{- $title = printf "%s %s %s" $title (default "::" site.Params.titleSeparator) $siteTitle }}
|
|
{{- else }}
|
|
{{- $title = printf "%s %s %s" $siteTitle (default "::" site.Params.titleSeparator) $title }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- return $title }} |