Skip to content

Support for i18n taxonomy #876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Wirone opened this issue Apr 12, 2022 · 2 comments
Closed

Support for i18n taxonomy #876

Wirone opened this issue Apr 12, 2022 · 2 comments
Labels
bug Something isn't working resolved Resolved Issue/Question

Comments

@Wirone
Copy link

Wirone commented Apr 12, 2022

First of all I would like to thank you for your work, I've just switched to this theme and it's great 👍

I wanted theme that supports i18n taxonomies in URLs. With config like

# config/languages.toml

[pl]
  [pl.taxonomies]
    category = "kategorie"
    tag = "tagi"
    series = "serie"

[en]
  [en.taxonomies]
    category = "categories"
    tag = "tags"
    series = "series"

this theme does this, almost. List of taxonomies work as intended and series, categories and tags are displayed in proper language. But I found that listing tags in single view does not work. I had to override _default/single.html layout and change code responsible for tags to this:

{{ $tagsTaxonomy := $.Site.Language.Params.Taxonomies.tag }}
{{- if (index .Params $tagsTaxonomy) }}
  <ul class="post-tags">
    {{- range ($.GetTerms $tagsTaxonomy) }}
    <li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
    {{- end }}
  </ul>
{{- end }}

It's because in front matter translated taxonomies have to be used to work with taxonomy lists, so for en I have tags = ["foo"] and for pl I have tagi = ["bar"]. I wanted to make PR with this but I thought it would be better to report issue because maybe you would like to implement it differently (also: I don't know if it would work with regular config, without translated taxonomies).

@adityatelange
Copy link
Owner

Oh yes! thanks for reporting this! 👍

I have added custom taxonomies for langs in demo 4dc6b44

Tags are present here https://adityatelange.github.io/hugo-PaperMod/fr/frtags/
But they are missing from https://adityatelange.github.io/hugo-PaperMod/fr/posts/markdown-syntax/

@adityatelange adityatelange added bug Something isn't working resolved Resolved Issue/Question labels Apr 23, 2022
@Wirone
Copy link
Author

Wirone commented Apr 23, 2022

Thank you, I'll try it later 🙂 As far as I see on demo page, it works as it should 👍

romainx pushed a commit to romainx/hugo-PaperMod that referenced this issue Jul 26, 2022
minyeamer pushed a commit to minyeamer/hugo-PaperMod that referenced this issue Sep 16, 2022
kylethedeveloper pushed a commit to kylethedeveloper/hugo-PaperMod that referenced this issue Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolved Resolved Issue/Question
Projects
None yet
Development

No branches or pull requests

2 participants