mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
nav: display translated taxonomy and terms title #772
This commit is contained in:
parent
af209c3f49
commit
288c6609d0
2 changed files with 21 additions and 2 deletions
|
@ -11,18 +11,29 @@
|
||||||
{{- $endarrow = "🡐" }}
|
{{- $endarrow = "🡐" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $next := "" }}
|
{{- $next := "" }}
|
||||||
|
{{- $nextTitle := .Title }}
|
||||||
{{- if eq .Page.Kind "taxonomy" }}
|
{{- if eq .Page.Kind "taxonomy" }}
|
||||||
{{- /* go to first term page */}}
|
{{- /* go to first term page */}}
|
||||||
{{- $pages := partialCached "partials/pageHelper/taxonomyPages.html" . . }}
|
{{- $pages := partialCached "partials/pageHelper/taxonomyPages.html" . . }}
|
||||||
{{- $next = (index $pages 0).Page }}
|
{{- $next = (index $pages 0).Page }}
|
||||||
|
{{- if $next }}
|
||||||
|
{{- $taxonomy_page := .Page }}
|
||||||
|
{{- $nextTitle = default (default $next.Data.Singular (i18n $next.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||||
|
{{- $nextTitle = printf "%s %s %s" $nextTitle (default "::" $next.Site.Params.titleSeparator) (default (humanize $next.Data.Term | strings.Title) $next.Title) }}
|
||||||
|
{{- end }}
|
||||||
{{- else if eq .Page.Kind "term" }}
|
{{- else if eq .Page.Kind "term" }}
|
||||||
{{- /* go to next term page */}}
|
{{- /* go to next term page */}}
|
||||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||||
{{- $pages := partialCached "partials/pageHelper/taxonomyPages.html" $taxonomy_page $taxonomy_page }}
|
{{- $pages := partialCached "partials/pageHelper/taxonomyPages.html" $taxonomy_page $taxonomy_page }}
|
||||||
{{- $next = partial "partials/pageHelper/next.html" (dict "collection" $pages "item" .) }}
|
{{- $next = partial "partials/pageHelper/next.html" (dict "collection" $pages "item" .) }}
|
||||||
|
{{- if $next }}
|
||||||
|
{{- $nextTitle = default (default $next.Data.Singular (i18n $next.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||||
|
{{- $nextTitle = printf "%s %s %s" $nextTitle (default "::" $next.Site.Params.titleSeparator) (default (humanize $next.Data.Term | strings.Title) $next.Title) }}
|
||||||
|
{{- end }}
|
||||||
{{- else if or (ne $outputFormat "html") (not (.Scratch.Get "relearnNextPage")) }}
|
{{- else if or (ne $outputFormat "html") (not (.Scratch.Get "relearnNextPage")) }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- $next = .Scratch.Get "relearnNextPage" }}
|
{{- $next = .Scratch.Get "relearnNextPage" }}
|
||||||
|
{{- $nextTitle = $next.Title }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- partial "topbar/func/button.html" (dict
|
{{- partial "topbar/func/button.html" (dict
|
||||||
"page" .
|
"page" .
|
||||||
|
@ -32,7 +43,7 @@
|
||||||
"onwidths" $onwidths
|
"onwidths" $onwidths
|
||||||
"onwidthm" $onwidthm
|
"onwidthm" $onwidthm
|
||||||
"onwidthl" $onwidthl
|
"onwidthl" $onwidthl
|
||||||
"hint" (printf "%s (%s)" ($next | default .).Title ($endarrow | safeHTML))
|
"hint" (printf "%s (%s)" $nextTitle ($endarrow | safeHTML))
|
||||||
)}}
|
)}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
|
@ -11,9 +11,11 @@
|
||||||
{{- $startarrow = "🡒" }}
|
{{- $startarrow = "🡒" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $prev := "" }}
|
{{- $prev := "" }}
|
||||||
|
{{- $prevTitle := .Title }}
|
||||||
{{- if and (eq .RelPermalink .Site.Home.RelPermalink) (eq $outputFormat "html") }}
|
{{- if and (eq .RelPermalink .Site.Home.RelPermalink) (eq $outputFormat "html") }}
|
||||||
{{- else if eq .Page.Kind "taxonomy" }}
|
{{- else if eq .Page.Kind "taxonomy" }}
|
||||||
{{- $prev = .Site.Home }}
|
{{- $prev = .Site.Home }}
|
||||||
|
{{- $prevTitle = $prev.Title }}
|
||||||
{{- else if eq .Page.Kind "term" }}
|
{{- else if eq .Page.Kind "term" }}
|
||||||
{{- /* go to previous term page or taxonomy page if it is the first term */}}
|
{{- /* go to previous term page or taxonomy page if it is the first term */}}
|
||||||
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
||||||
|
@ -21,11 +23,17 @@
|
||||||
{{- $prev = partial "partials/pageHelper/prev.html" (dict "collection" $pages "item" .) }}
|
{{- $prev = partial "partials/pageHelper/prev.html" (dict "collection" $pages "item" .) }}
|
||||||
{{- if not $prev }}
|
{{- if not $prev }}
|
||||||
{{- $prev = $taxonomy_page }}
|
{{- $prev = $taxonomy_page }}
|
||||||
|
{{- $prevTitle = default (default $prev.Data.Plural (i18n $prev.Data.Plural)) $prev.Params.Title }}
|
||||||
|
{{- else }}
|
||||||
|
{{- $prevTitle = default (default $prev.Data.Singular (i18n $prev.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
||||||
|
{{- $prevTitle = printf "%s %s %s" $prevTitle (default "::" $prev.Site.Params.titleSeparator) (default (humanize $prev.Data.Term | strings.Title) $prev.Title) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- else if or (ne $outputFormat "html") (not (.Scratch.Get "relearnPrevPage")) }}
|
{{- else if or (ne $outputFormat "html") (not (.Scratch.Get "relearnPrevPage")) }}
|
||||||
{{- $prev = .Site.Home }}
|
{{- $prev = .Site.Home }}
|
||||||
|
{{- $prevTitle = $prev.Title }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- $prev = .Scratch.Get "relearnPrevPage" }}
|
{{- $prev = .Scratch.Get "relearnPrevPage" }}
|
||||||
|
{{- $prevTitle = $prev.Title }}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- partial "topbar/func/button.html" (dict
|
{{- partial "topbar/func/button.html" (dict
|
||||||
"page" .
|
"page" .
|
||||||
|
@ -35,7 +43,7 @@
|
||||||
"onwidths" $onwidths
|
"onwidths" $onwidths
|
||||||
"onwidthm" $onwidthm
|
"onwidthm" $onwidthm
|
||||||
"onwidthl" $onwidthl
|
"onwidthl" $onwidthl
|
||||||
"hint" (printf "%s (%s)" ($prev | default .).Title ($startarrow | safeHTML))
|
"hint" (printf "%s (%s)" $prevTitle ($startarrow | safeHTML))
|
||||||
)}}
|
)}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
Loading…
Reference in a new issue