Lazy Menu Example not working

Hi folks,

I just copied and pasted the lazy menu from the docs. But no item is showing up.

I put this in my config.toml

sectionPagesMenu = "main"

And this in my baseof.html

<nav class="sidebar-nav">
    {{ $currentPage := . }}
    {{ range .Site.Menus.main }}
    <a class="sidebar-nav-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a>
    {{ end }}
</nav>

I see the nav is rendered to the page but there is no item in it. The docs state these two things is all what’s required. https://gohugo.io/templates/menu-templates/#section-menu-for-lazy-bloggers

What am I missing?

Not sure, I can’t reproduce. Share your project, please. :slight_smile:

I found out the issue, Its probably very obvious to someone more experienced as the name sectionPagesMenu implies.

This lazy menu will only render links to other sections. A section is essentially a sub folder in the content folder. E.g. /content/post, post would be the name of the section.

I have no sub folder in my content folder, therefore not link to any section would show up.

I am still a bit confused why the default section would not show. Does this mean it’s not considered a section? Am I not supposed to deploy pots without subfolder?

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.