alex-shpak / hugo-book

Hugo documentation theme as simple as plain book
https://hugo-book-demo.netlify.app
MIT License
3.4k stars 1.17k forks source link

Menu not appearing on homepage, menu items missing on other pages #650

Closed hcavanaugh closed 1 month ago

hcavanaugh commented 1 month ago

I am not sure if this is an issue with the theme, Hugo, or my understanding of either...

According to the theme docs, By default, the theme will render pages from the content/docs section as a menu in a tree structure.

This is the structure I have currently in my content directory:

├── content/
│   ├── index.html
│   ├── docs/
│   │   ├── 2024/
│   │   │   ├── test-essay.html
│   │   └── about.html

When I go to the homepage, none of the menu items appear. When I go to /about/, the 2024 and About menu items appear (not the test essay page). When I go to /2024/, the 2024 menu item appears with a th next to it? The test essay link appears underneath 2024th. The About menu link is missing. See the screenshot. Screenshot 2024-09-05 201751

I have already tried: -Setting bookSection to '*' instead of the default docs. -Adding index.md or index.html to the 2024/ directory -Refreshing my cache -Re-running hugo server --minify --theme hugo-book

Any help would be appreciated, as I'm not having much luck in either set of docs and find the document structure system baffling.

hcavanaugh commented 1 month ago

I figured it out after copying over the example site and working backwards from there. For those reading this, you need to add the _ in front of the index files, and include an _index.md or _index.html in the subdirectory. I just left the 2024/_index.html file with only the front matter (no content) to avoid making the subdirectory a link.

My directory now looks like this:

├── content/
│   ├── _index.html
│   ├── docs/
│   │   ├── 2024/
│   │   │   ├── _index.html
│   │   │   ├── test-essay.html
│   │   └── about.html