What’s the correct way to print the menus from hugo.yaml? Let me explain what I try to achieve. My goal is to select menus based on directory structure. Looking at the current repository, /docs/hugo.yaml has a set of menus, while module /project/hugo.yaml has an additional set of menus and following mounts:
Which creates the module pages inside /docs/project. My goal is to load a different set of menus, when I’m building /docs/project. Since I defined sectionPagesMenu: project, I expect the navbar to pick the correct set of menus. I have the following condition into navbar:
@jmooring thank you for taking the time to look into this, I apologize for late response. I think the easiest way is to clone the repo and run the hugo server, to understand better the issue. I’m doing exactly what you mention above, see related code.
If you run hugo server at directory root:
hugo server --disableFastRender --logLevel debug -Ds ./docs
The new menus present into /project/hugo.yaml should load, since they are clearly defined into module configuration file with sectionPagesMenu.
In order to achieve the desired results (see live example for /docs and /docs/project), I have to run twice the deployment, which breaks the sitemap and adds a lot of duplicated files into /docs/public, as well /docs/public/project.
I apologize in advance for the lengthy reply. I’ve been trying to fix this issue for over a week, spending many hours, without any progress.
I apologize, I’m very new at Hugo, I was looking at the documentation and it was not specified. I’ll move it under params. The funny part is that I had the $menu coded correctly, novice mistake.
I was reading somewhere into documentation that the layouts partials are interpreted differently, so I thought is related to that. I’m going to change the code later and report back, thank you!
Or it should be .Site.SectionPagesMenu first letter upper camel case, like into source code.
I cannot find absolutely nothing on the Internet.
Edit: Netlify to the rescue, the correct value is either .Site.Params.SectionPagesMenu or .Site.Params.SectionPagesMenu. I’m going to use the first choice, for Uniformity with other defined variables.
@jmooring I reverted back the menus to main. I’m trying to understand what condition I need to implement, so Hugo can see the new navbar menus present into /projects/hugo.yaml module, at build time.
The menus are displayed correctly into sidebar, so the configuration variables are properly read.