The word “kurztipp” translated into English is “quick-tip”. On German web pages, I use “kurztipp” as the tag name and “quick-tip” on the translated pages. How can I create a connection between the tags? If I display the tag list “quick-tip” and change the language to German the German blog posts should be displayed with the tag “kurztipp” and vice versa. If the tag name is identical in German and English it works.
Under themes/mytheme/layouts/taxonomy/tag I created two Front Matter Markdown files with an identical translationKey:
git clone --single-branch -b hugo-forum-topic-42516 https://github.com/jmooring/hugo-testing hugo-forum-topic-42516
cd hugo-forum-topic-42516
hugo server
You do not separate your translations by directory, but instead use this structure:
content/posts/
├── post-1.en.md
└── post-1.md
Which is fine; we just need to use a different approach to translate and link the tags.
Please pull this again and test:
git clone --single-branch -b hugo-forum-topic-42516 https://github.com/jmooring/hugo-testing hugo-forum-topic-42516
cd hugo-forum-topic-42516
hugo server
With this approach you use the same tag for all languages, but control its appearance (name) and URL in the term’s front matter.
You will need to modify your tag cloud code accordingly, something like:
Do I understand this correctly now? For a multilingual website I have to create directories for the different languages in the content directory - de, en. Then I copy my current Page Bundles into both directories. Delete index.en.md in the “de” directory and index.md in the “en” directory and index.en.md is renamed to index.md. I have to change the config.toml accordingly.
I still come from a time when memory was valuable. That’s why I liked the Page Bundles approach - store images only once, for one blog post all in one place and not scattered in different directories. My blog posts are all about Hugo and web design. It makes no sense to translate English IT terms into German, then no one understands you anymore. “Kurztipp” = “Quick-tip” is therefore the only tag which is different from the language. It’s amazing that the whole thing worked at all until now.
As I understand it, we need to create an _index.md file with that translationKey in frontmatter for each of our tags, right? Guess there’s no way to automate it
There are two methods to organize multilingual site content. Whether or not you need a translation key depends on which method you choose. And this discussion is limited to taxonomy term translations, including the URL.
Thanks, Joe. In my case I’m using different folders for each of my languages. Didn’t know about that bypassing though, so I was keeping always the same structure.
Thanks a lot Joe. Your advice on displaying the tags instead of {{ with .Params.tags }} {{ range . }} to output the tags with {{ range .GetTerms “tags” }} was key in addition to the hints above. Now “kurztipp” is also translated correctly.