Thanks to visit codestin.com
Credit goes to github.com

Skip to content

_index.md required for section pages in multilingual sites with separate contentDir (undocumented breaking change) #14681

@cebor

Description

@cebor

Describe the bug

In a multilingual Hugo site with separate contentDir per language and defaultContentLanguageInSubdir: true, section pages (e.g. posts/index.html) are no longer generated for languages that don't have a _index.md in the section directory. This worked without _index.md in previous versions and appears to have regressed at some point in recent releases.

Hugo version

v0.159.1

Minimal reproduction

Config (hugo.yml):

defaultContentLanguage: en
defaultContentLanguageInSubdir: true
languages:
  en:
    contentDir: content/en
    weight: 1
  de:
    contentDir: content/de
    weight: 2

Content structure:

content/
├── de/
│   └── posts/
│       └── some-post.md        # no _index.md
└── en/
    └── posts/
        └── some-post.md        # no _index.md

Expected behavior

public/de/posts/index.html and public/en/posts/index.html are generated, as documented. The [content organization docs](https://gohugo.io/content-management/sections/) state that _index.md is optional for sections.

Actual behavior

Section index.html is not generated for one or both languages. Adding _index.md to each section directory fixes the issue.

Workaround

Add an _index.md (can be empty or with minimal frontmatter) to each section directory for every language:

content/de/posts/_index.md
content/en/posts/_index.md

Additional context

If this is intentional behavior, the documentation for [multilingual sites](https://gohugo.io/content-management/multilingual/) and [content sections](https://gohugo.io/content-management/sections/) should be updated to reflect that _index.md is required for section pages in multilingual setups with separate contentDir. Currently the docs describe it as optional, which is misleading.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions