Hi,
I am looking for a bit of help with Translatable categories.
in content\categories I got folders with all categories that I am using across the posts, for example summer
Inside summer folder I got _index.md (for English)
---
title: "Summer"
---
and _index.pl.md for Polish.
---
title: "Lato"
---
Across posts, in front matter, I am only using single version of categories, in English, in both, English and Polish translation.
categories:
- Summer
This works nicely, displaying the Post category in English (_index.md) and in Polish, as specified in _index.pl.md.
Example how its working on main site:
<div class="list-of-categories">
{{ range .Site.Taxonomies.categories.ByCount }}
<span><a href="{{ .Page.RelPermalink }}" aria-label="{{ .Page.Title | lower }}, Number of Recipes: {{ .Count }}">{{ .Page.Title | upper }}</a> <sup aria-hidden="true">{{ .Count }}</sup></span>
{{ end }}
</div>
and how is working on post:
{{ with .GetTerms "categories" }}
<div class="category" aria-label="Categories">
{{ range . }}
<a class="r-category" href="{{ .Permalink | lower }}">{{ .LinkTitle | upper}}</a>
{{ end }}
</div>
{{ end }}
Now, I though this will work in same manner in breadcrumbs, but its not. Even on Polish, categories are displayed in English form (as specified in frontmatter) and not ad specified in _index.pl.md
.
My code for breadcrumbs:
<nav aria-label="Breadcrumb">
<ol class="breadcrumb">
<li>
<a href="/">{{ T "Home" }}</a>
</li>
{{ if .Params.categories }}
<li>
{{ range .Params.categories }}
<span aria-hidden="true">»</span> <a aria-label="{{ T "Category" }}: {{ . }}" href="{{ . | urlize | absLangURL | lower }}/">{{ . }}</a>
{{ end }}
</li>
<li>
<span aria-hidden="true">»</span> <a href="{{ .RelPermalink }}" aria-current="page">{{.Title}}</a>
</li>
{{ else }}
<li>
<span aria-hidden="true">»</span> <a href="{{ .RelPermalink }}" aria-current="page">{{.Title}}</a>
</li>
{{ end }}
</ol>
</nav>
I understand that it displays, through range
as it asked, hence it’s taking exactly as it stated in the frontmatter, however in the categories example it’s translating them, whereas in breadcrumbs is not.
Help appreciated.