Hugo

Taxonomy terms page permalink - how to change it?

Form the docs, I know that

Much like regular pages, taxonomy list permalinks are configurable, but taxonomy term page permalinks are not.

…which is in my opinion and without the intention to offend anyone, a bit useless this way. Why would you have for example a custom taxonomy list url if the term page cannot be changed so the two cannot be the same (e.g. /autor/ for the term page and /autor/goethe as the taxonomy list).

I have also found this:

It suggests some changes to the Go code. Is it possible to include that in Hugo’s code base (I can create a PR, but is that a right solution etc?)

I am not sure if I understand what you are complaining about:

/taxonomy/ = list permalink
/taxonomy/term = term permalink

If you change taxonomy to receipts

/receipts/ = list permalink
/receipts/term = term permalink

Why would the term permalink need to change if it’s identical to the term. Your request sounds like you want to have an URL like /receipts/somethingsomething for the term term?

Can you please try to explain better with examples of what works, what not works? Maybe it’s just interpretation (I myself always mix those terms up, but am very happy with whats possible within regards to permalinks).

An example:

[taxonomies]
  author = "authors"

[permalinks]
  authors = "/szerzok/:slug/"

Szerző means author in Hungarian, but the taxonomy name, I would like to keep in English as it “generates” a “variable” (.Params.authors) which I would like to keep readable by everyone. So my idea was to define a permalink for the authors taxonomy (see the permalinks section of the code above) with the following expected result:

  • /authors/ —> /szerzok/ (list permalink in Hungarian but the taxonomy name kept in English)
  • /authors/SomeName/ —> /szerzok/SomeName/ (term permalink… as for the list permalink)

The first expectation is achieved by the code I’ve shown above, the second isn’t. I think a similar example is given in the forum link I included in my original post.

Note, that this may be a bad practice - I am a newbie, so I am not sure.

To me this sounds like an i18n thing. I am a newbie to localization, I hope someone else can help.

I think what you have to do (and how it is thought to work) is to translate the slug for each language. If you use only one language you still need to create a i18n package for that language. But that is where my knowledge and experience ends. I will monitor this topic to learn because I just changed a mono-lingual site to implement that whole i18n stuff :wink:

Maybe that here :wink:

I think you are right, this is place for localization. Thanks for the answers.

After reading the docs, I am not that sure how exactly I should translate taxonomies. Could anyone help please with an example where there is an English taxonomy and a translation?

@pkollitsch could you please explain to me how you “translated” taxonomies? For example, can I have a taxonomy defined in English and then have a Hungarian equivalent such that the system knows the two are synonymous but in different languages and the one corresponding to the currently active language is rendered in pages, URLs?

With this, am I able to write in the code .Params.authors and have in the URL /szerzok/...? (note that szerzo = author, szerzok = authors)