I18n + range loop section

I have a multilingual website with translation by content directory.

├─ en/
│  ├─ blog
│     ├─ _index.md
│     ├─ post1.md
│     ├─ post2.md
├─ fr/
│  ├─ blog
│     ├─ _index.md
│     ├─ post1.md
│     ├─ post2.md
    contentDir = "content/en"
    contentDir = "content/fr"

I want to iterate\loop over the posts in the blog in the current language (let’s say “en”), so I use:

{{ range where .Site.RegularPages "Section" "blog" }}

… and it doesn’t work because it turns out that sections are “en” and “fr”.
“blog” is subsection.

How to perform seamless iteration (I mean, considering the current language and only with its posts)?

What’s the best practice when dealing with i18n in that case?


Do you have a modules.mount config as well?

No. I didn’t think it was so complicated… I will figure it out… Thanks for the tip

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.