I added code I found on the community for a recursive menu
Fairly certain that I want a parent link in the nav to NOT navigate to the _index.md content but rather to open submenus (eventually accordion style)
My top-level Menu Items (Gizmos and Widgets) have an overview page that is the _index.md and results in a list of children items. In the case of Gizmos, that is Overview, Resources, Tutorial, and a branch bundle—Articles.
Question: How do I make the branch bundle, Articles, have an overview page that lists the 3 articles?
I have tried a number of different things in the front-matter and I can’t get it to work.
Hi Patrick, thanks for the suggestion. I tried that, but no luck. If that file does not have a parent declared, then it makes it a top-level item, where as I want that Overview page to be under Gizmos. Also, I want the same behavior in the nested items below(e.g. Articles). Anyway, I’ll keep working at it. Thanks!
Keep the repo public. I’ll try to find time tomorrow to load it and see what I can do. The templates don’t look faulty to me, so it’s probably within the frontmatter somewhere.
Will do. The repo is just a test site for me to make it easier to ask questions. I appreciate the help. To be clear, here is what I think I am trying to accomplish:
Gizmos (parent, opens menu)
Overview (_index.md, list template, displays top-level children in this section: Tutorial, Resources, Articles)
Tutorial
Resources
Articles (parent, opens menu)
Overview (_index.md, list template, displays top-level children in this section: Article 1, 2 and 3)
Thanks again, Patrick. When I do as you suggest, the articles section gets pulled out of the gizmos section. It is supposed to be nested under the Gizmos section.
I am just looking for a way to build a mult-level menu system. Parents open an accordion to reveal the children. Click on the children and they navigate to the content. I am just looking for standard behavior. Nothing out of the ordinary. Here is a very common example:
So the way I understand your question is that there are really two parts to it:
What structure / hierarchy do you want generated: What pages get nested under where
How to style it. The ‘accordion style’ that you reference is really a mix of CSS and probably some JS, and technically is outside the scope of Hugo and these forums.
We can probably help you with the first, and that should help you get the rest of the way with styling your menu.
So back to the first part:
When I run your site and navigate to /docs/, I see the following menu in the sidebar:
Hi, Pointyfar. Thanks for your help. CSS styles are out of the scope of this question. This post is specifically dealing with structure. Your outline follows what I had posted above. So to answer you first question, yes this is the hierarchy I want. But to be clear its technically
Home
About
Contact
Docs
Gizmos
Overview
Resources
Tutorial
Articles
Article 1
Article 2
Article 3
Widgets
Overview
Resources
Tutorial
But this question is just focusing on the docs section and making a nested menu for the docs content. Make sense?