Links in index.md not works

Hi

I created index.md in a folder and next to this file are articles which are the chapters of a book which are titles in index.md

The problem is that the links (titles) in this file index.md do not work but for _index.md they work well

I want to use index.md to not show the list of items included in the folder

only the titles and their links

I use : [chapter1] (the-chapter-1 “chapter1”) to show the links

do you have a solution to make the links work?

content/
└── books/
    └── book-1/
        ├── chapter-1.md   <-- page resource (not a page)
        ├── chapter-2.md   <-- page resource (not a page)
        └── index.md       <-- leaf bundle

The presence of an index.md file makes the directory a leaf bundle. The other files in the directory are page resources, not pages.

https://gohugo.io/content-management/page-bundles/

If you want chapter-1.md to be a page, rename index.md to _index.md. The presence of an _index.md file makes the directory a branch bundle.

1 Like

When i rename index.md to _index.md
a list of articles ( chapters ) are displayed I want to display only the content of _index.md without overwriting the list file of articles in the parent folder ( books ) is there a solution?

I do not understand your question.

You have to change the layout. By default, it’s using the list layout. Either change layouts/_default/list.html, or layouts/mybook/list.html, or set layout: "foo" in _index.md and then define layouts/_default/foo.html.