I have inherited a Hugo docs site which has got into a bit of a mess over time.
I’m not an advanced web dev and I don’t know Go. However, I am technically minded and can follow technical docs fairly well.
The docs I’m working on have a linear menu, so every page referenced on the left menu bar refers to one single index.md. Some of these index.md pages are in the 1000s of lines long now as devs continually append content to a single page.
I figured it would be a simple thing to start restructuring and splitting out these pages into a nested menu configuration. However, after an afternoon of playing with Hugo, I have really no idea where to begin.
For example, when I read the Nested Menu documentation https://gohugo.io/content-management/menus/#nesting I don’t know where the parent field is, where to add any info, the instructions are so sparse, I really haven’t a clue what to do…
Which refers to very, very long html pages, one per menu item. name url identifier makes sense (although I don’t know where you might need the identifier later on).
I don’t know what weight means. I looked it up and it mentions menu entry variables, but I’ve no idea where/what they are or how they work.
I then find Menu Templates which looks like I need to edit the Theme itself to create a nested menu. Is this correct?
Is there any self-starting quick start doc about nested menus that might help me?
You might need an identifier for when you have menu entries that have the same name, or an entry that appears multiple times (and, for example, have diffferent child menus).
It’s probably easier to play around with a smaller lorem ipsum site to see how Hugo works, instead of diving straight into a messy pile. Also, please note Requesting Help and Recommended Reading Reference .
Everything pointyfar said, and also check the site you’ve inherited to see if it uses a theme made by someone else. It could had docs explaining how it works.
I add a child entry below it for one of the new subpages.
[[menu.main]]
name = “FAQ General”
url = “/faq/general/”
identifier = “general”
parent = “faq”
weight = 1 ? presuming 1 will order this subpage at the top
But nothing changes apart from the ordering of all the content on the single /faq/ page into alphabetical order. There is no separate FAQ General submenu and going to /faq/general/ generates a 404.
Normally I’d clone and take it for a spin, but I personally don’t know how to clone just a sub-folder, and I’m not gonna learn or download the entire dgraph repo.
Your content subfolders have both index.md and _index.md. This is probably causing issues somewhere as both content/foo/bar/_index.md and content/foo/bar/index.md will probably try to render at yoursite.com/foo/bar/. But which page is actually there? Have a read here and here.
Note that creating a menu entry does not create a page, so if it 404s, it’s probably because the page itself is missing.
Depending on which one you keep, ie faq/_index.md vs faq/index.md, faq/general/ may or may not be created. See above docs linked.