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: categories:
other: Categories other: Categories
category:
other: Category
tags: tags:
other: Tags other: Tags
tag:
other: Tag
article: article:
back: back:
other: Back other: Back

View file

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

View file

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