Render multilingual content from the same template

How does Hugo associate content from different languages as the same template? For example, I have set up the localization, and am able to localize a ‘page’ in two languages- spanish and english - as in the example below. Thus, the “contact” page correlates to “contacto” in spanish. However, when opening content that uses a list template (this also includes the use of an _index.md file), it seemingly wants to list content from the /posts directory. I have verified this because the two entries that show up are in the “posts” folder, and not the “poetry” folder. The /posts directory is originally a part of the theme I am using, but I would like not to use the name “posts”. So, in this example I would like to match “poetry” to “poesia”. How would Hugo correlate the two so that when using the language selector link, it can pivot between both easily? The language selector also works for the “contact” link, but it disappears when opening the link to /en/poetry - as though it has no knowledge of the the equivalent translation. Further, it also does not show the right content.


[[Languages.en.menu.main]]
name = "Poetry"
url = "/en/poetry/"
weight = 4

....[other menu sections here]...

[[Languages.es.menu.main]]
name = "Poesia"
url = "/es/poesia/"
weight = 4

[[Languages.es.menu.main]]
name = "Contacto"
url = "/es/contacto"
weight = 5

You are more likely to receive a prompt and accurate response if you post a link to the public repository for your project.

See Requesting Help.

Let us see your code

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.