Skip to content
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

Broken taxonomy terms links (~~Translation of taxonomy terms~~) #160

Closed
Guillawme opened this issue Jul 10, 2018 · 5 comments
Closed

Broken taxonomy terms links (~~Translation of taxonomy terms~~) #160

Guillawme opened this issue Jul 10, 2018 · 5 comments

Comments

@Guillawme
Copy link

Hello there,

I am trying to do exactly what is described here: translating taxonomy terms (in my case, categories and tags, but that could be anything else). And I have the same problem: taxonomy terms won't translate, no matter what I write in i18n/my-language.toml.

I understand the principle of the suggested solution, and I know it should be possible to write my own templates and make them take precedence over the ones in Minimo (that's the way Hugo works), but I have near-zero experience with web design (which is why I am using an already made theme and not designing my own) and I am unable to figure out which template files I need to customize.

Would it be possible to add the capability to translate taxonomy terms to Minimo?
Thank you so much in advance.

@MunifTanjim
Copy link
Owner

MunifTanjim commented Jul 10, 2018

taxonomy terms won't translate, no matter what I write in i18n/my-language.toml.

i18n directory is not generally for translating contents.

I have near-zero experience with web design (which is why I am using an already made theme and not designing my own) and I am unable to figure out which template files I need to customize.

You don't need to touch any template files for doing what you want.

Let's see an example:

Suppose, you want to translate a category named movie. Just create a file (for English): /content/categories/movie/_index.en.md with the following frontmatter:

title: Movie (in english)

And for French, create a file: /content/categories/movie/_index.fr.md with the following frontmatter:

title: Movie (in french)

You can do this for any Language and any taxonomy terms.

And add that category in your content's frontmatter, like this:

categories:
  - movie

Let me know if you had any problem.

@Guillawme
Copy link
Author

Ah, this point was completely unclear to me from Hugo's documentation. Thank you, that's very helpful and it indeed works fine this way.

@Guillawme
Copy link
Author

Reopening this, because I noticed something doesn't work with multilingual taxonomies. Here is an example.

I have a tag hiking and its fr translation randonnees, set up this way: default language is en, and I have content/tags/hiking/_index.fr.md. This file contains:

---
title: Randonnées
slug: randonnees
---

I also have this in my config.toml:

[permalinks]
tags = "/tags/:slug/"

And in my posts, I have hiking listed in tags in the front matter.

What should happen: in the fr version of the site, the page example.com/fr/tags should have tags listed in French, and clicking such tags should direct to their fr slug.

What happens instead: on the page example.com/fr/tags, tags are displayed correctly (i.e. they are translated OK), but clicking on them directs to their slug in the default language (which I also set explicitly in content/tags/hiking/_index.md), and because this path is not built under fr this leads to a page not found. If I edit the URL to replace the default language slug by the translated slug, I can get the term page to display fine (so it is built correctly, simply not linked to correctly).

This time it seems it's because of a template not following the permalink settings.

I hope you can help with that.

@Guillawme Guillawme reopened this Aug 4, 2018
@MunifTanjim
Copy link
Owner

@Guilz this should solve the issue.

@MunifTanjim MunifTanjim changed the title Translation of taxonomy terms Broken taxonomy terms links (~~Translation of taxonomy terms~~) Aug 5, 2018
@Guillawme
Copy link
Author

It solved it, thank you. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants