I am hoping to set up a multilingual site in Hugo and I’m looking for advice on how to best manage the files. I’ve done my best to study the docs, but I think I may need some help. I have two problems I’m trying to solve:
- I have some pages that need to exist in all locales (with translated content). Each has its own layout. For example, I might have
www.mysite.com/es/hola, which look identical apart from the text.
I believe the standard way to handle this would be like this?
content/hello/_index.en.md content/hello/_index.es.md layouts/section/hello.html
and then I include
url: "es/hola" in the frontmatter of
_index.es.md? I would rather be able to specify a slug of “hola” and have the “es/” part of the URL be inferred – is there any way to do that? Or is there a better way to handle this?
- I have some pages – let’s call them posts – that all use the same layout. Each locale will have its own posts (they won’t be translations of each other). The routes should look like
www.mysite.com/es/entradas/una-entrada. I can get this to work by putting everything in content/posts with either the
.es.mdextension, but then my Spanish posts are called posts instead of entradas. What’s more, my posts will become very hard to manage if I have to put them all in the same folder – I’d really like to have them in separate folders per locale without messing up the routing. Is there any Hugo functionality that can help me with this, or do I just have to put my English posts in
content/postsand my Spanish posts in
content/es/postsand forget about translating “posts”?