title: "Optimización del Rendimiento"
tags: ["Rendimiento", "Tecnología"]
The sitemap correctly lists the tag pages, but there is no <hreflang> linking between corresponding tags. That means “Performance” and “Rendimiento” (or “Tech” and “Tecnología”) are treated completely separately, even though they belong to translated articles.
My question:
Is there a way to configure Hugo so that the sitemap reflects the relationship between multilingual tags based on the articles they belong to? Ideally, I’d like the sitemap to indicate which tags correspond across languages, similar to how article translations use <hreflang>.
Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.
If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.
Thanks a lot for your reply and help! I tried the hugo-multilingual-example you shared, and it works exactly as expected — multilingual tags with the same meaning are correctly linked in the sitemap.
I understand, thank you. “hugo-multilingual-example” also created separate multilingual content files for the ‘tags’ taxonomy, while “hugo-theme-yue” did not.
Website A: In the content/tags/ directory, _index.[language code].md files were created for each language version of every tag (e.g., content/tags/green/_index.en.md and content/tags/grün/_index.de.md). This file naming convention explicitly tells Hugo that the tags ‘green’ and ‘grün’ are translations of each other. This is key for tags to get hreflang associations.
Website B: Did not create such _index.[language code].md files in the content/tags/ directory to explicitly associate tag translations. Therefore, although the articles themselves have translation associations, the tags, as an independent taxonomy, did not receive this explicit cross-language signal, so their sitemap does not include hreflang.
Simply put, the .[language code].md association for articles only applies to the articles themselves. Tags require their own _index.[language code].md files to establish cross-language associations. “hugo-multilingual-example” did this, “hugo-theme-yue” did not.
No problem, everything is fine. Thank you for your help. The issue was because I hadn’t created a ‘tags’ directory in my own instance to use as the “translationKey.”