feat: localize new taxonomy names

- Tag links now use the actual taxonomy name for the URL and the displayed label is wrapped in a translation macro instead of the previous placeholder-based logic.
- Simplify the taxonomy tag URL by passing the name directly and add translation support for the tag label.
- Introduce a new taxon_name_i18n variable to translate the taxonomy name and swap in this localized value for the page title and “See all” link, while also simplifying the all-taxa URL by passing taxonomy.name directly to get_url.

Signed-off-by: CHEN, CHUN <jim60105@gmail.com>
This commit is contained in:
CHEN, CHUN
2025-05-15 00:09:07 +08:00
parent 71c4fd5a8c
commit 6ae1db5c74
3 changed files with 6 additions and 5 deletions

View File

@ -62,7 +62,7 @@
{%- if page.taxonomies -%}
{%- for name, taxon in page.taxonomies %}
<ul class="tags">
<a class="tag" href="{{- get_url(path='$TAXON', lang=lang) | replace(from="$TAXON", to=name) | lower -}}">{{ name }}:</a>
<a class="tag" href="{{- get_url(path=name, lang=lang) | lower -}}">{{ macros_translate::translate(key=name, default=name, language_strings=language_strings) }}:</a>
{%- for item in taxon -%}
<li><a class="tag" href="{{ get_taxonomy_url(kind=name, name=item, lang=lang) }}">{{ item }}</a></li>
{%- endfor %}