Multilingual Site with separate posts directories makes posts available on multiple links

I have my blog generated via Hugo. It is a Multilingual site with two languages available, English (en) and Bengali (bn).

I have my English posts in content/posts directory and Bengali posts at content/bengali/posts; And as usual my posts have standard metadata such as title, lang, description etc.

By default, Bengali posts get generated at URLs sometime like domain.tld/bn/post1. But they are also available at domain.tld/bn/bengali/posts/post1

For this issue, my Related Posts and Next/Previous Post getting filled with duplicate posts of different links of a same post.

My theme is created by me from scratch.

A demo Bengali post with the aforementioned problem, so you folks can check this issue:

  1. https://palashbauri.in/bn/aami-depression-e-akranto/

  2. https://palashbauri.in/bn/bengali/posts/aami-depression-e-akranto/>

Here’s an example of a multilingual site where the content for each language is kept in separate directories.

structure

content/
├── de/
│   ├── posts/
│   │   └── post-1.md
│   └── _index.md
└── en/
    ├── posts/
    │   └── post-1.md
    └── _index.md

configuration

[languages.en]
contentDir = 'content/en'
languageCode = 'en-US'
languageName = 'English'
weight = 1

[languages.de]
contentDir = 'content/de'
languageCode = 'de-DE'
languageName = 'Deutsch'
weight = 2

This is documented here:
https://gohugo.io/content-management/multilingual/#translation-by-content-directory

Thanks. It fixed the duplicate links issue

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