I am trying to get the slugs of my site to be adapted for each language.
Based on this section of the documentation, it is possible to define a different slug for a secondary language using the slug = "my-new-slug" in frontmatter.
The example uses the following structure:
/content/about.md
/content/about.fr.md
My site structure however is different and uses an _index.md for each section of the site, resulting in the following structure:
The problem with this is that defining the slug="a-propos" in about/_index.fr.md for example - or any of these files - does not seem to work for me.
Is this a known issue or am I missing something?
Thanks
EDIT: I’m using the following version of Hugo Hugo Static Site Generator v0.26-DEV linux/amd64 BuildDate: 2017-07-11T08:53:51Z
I faced this problem with Hugo v0.25.1, but it gone away.
It’s a pity that I did not catch exactly what behavior caused this (I just explored HUGO and I am in first dirty&rapid learning cycle ;-), but I got feeling that there could be two reasons:
when I changed menus in config.toml, than if I use hugo server, than it is better to restart it
another is that I had some problem in the same config.toml
OK great - I also have multilingual menus in config. If you tell me that it worked for you, I’ll keep on trying. I also restart hugo most of the time when I do such changes, but it didn’t resolve my issue so far.
For the record, this is what is in the doc, so it might be the issue…
Hugo currently uses the base filename as the translation key, which can be an issue with identical filenames in different sections. We will fix this in https://github.com/gohugoio/hugo/issues/2699
It was a bit confusing when using menus, because they are relative to current page or with “…/” to web/server root while slug to language root, f.ex. http://wwwroot/lv/
And watch out - if you not use absolute urls with "…/section/page your menus will become like …/section/page/section/page when you click in you page.
I hope I had not mess the terms in English an it helps.
Your case is different: you’re changing a slug to an article inside the ‘page’ section. @pascal and I are trying to localize the slug for the section itself (in my case site.com/news/ for English and site.ru/новости/ for Russian), so all menus and other links/internal variables will work correctly.
Looks like most of the frontmatter variables from _index* pages are treated correctly, but not a ‘slug’ or ‘url’. And I also saw an issue that ‘type’ and ‘layout’ are also not supported yet for section’s _index.md files.