fix title translation

This commit is contained in:
Buliway 2024-07-11 16:25:15 +03:00
parent fee8af4fca
commit 2016a63577
3 changed files with 24 additions and 1 deletions

View file

@ -19,9 +19,15 @@ list:
categories:
other: Categories
category:
other: Category
tags:
other: Tags
tag:
other: Tag
article:
back:
other: Back

View file

@ -23,9 +23,15 @@ list:
categories:
other: Категории
category:
other: Категория
tags:
other: Теги
tag:
other: Тег
article:
back:
other: Назад

View file

@ -24,7 +24,15 @@
{{ $pag := .Paginate ($notHidden) }}
<!-- {TAXONOMY_TYPE}: {TAXONOMY_TERM} -->
{{ $title = slice (title .Data.Singular) ": " $title }}
{{ $taxonomyTerm := .Title }}
{{ $taxonomyType := T (printf "list.%s" .Data.Singular | urlize | lower) }}
{{ if eq (lower .Section) "tags" }}
{{ $translatedTag := T (printf "tags.%s" $taxonomyTerm | urlize | lower) }}
{{ $taxonomyTerm = $translatedTag | default $taxonomyTerm }}
{{ end }}
{{ $title = slice (title $taxonomyType) ": " $taxonomyTerm }}
{{ if .Paginator.HasPrev }}
<!-- Add page number-->
@ -33,6 +41,9 @@
{{ $title = $title | append " - " $siteTitle }}
{{ $title = delimit $title "" }}
{{- else if eq .Kind "taxonomy" -}}
<!-- Taxonomy overview page (e.g., /tags/, /categories/) -->
{{ $title = T (printf "list.%s" $title | urlize | lower) }}
{{- end -}}
{{ return $title }}