Exclude page from menu?


I have something like this

	   <h2>more articles</h2> 
            {{ $act_section := .Section}}           
            {{ range where .Site.Pages "Section" $act_section }}  
        		 <li><a href="{{ .RelPermalink }}">{{- .LinkTitle -}}</a></li> 
            {{ end }}      

to create a menu for all pages within a section - this will be redered as a sidemenu on each page.
Now if I have one single page within that section which I would like to exclude from the menu - how could I do that?
This single page should only be acessible from one of the other pages (e. g. you have a guestbook (I know, old stuff :wink: ) and the page to create a new entry should only be accessible from the guestbook itself, not from the other pages in that e. g. “contact” section which also includes those pages like impressum, data privacy, contact form etc.).

To make it flexible you could add front matter to pages you want excluded, and they range over it again to find pages without noMenu = true, or something similar. :slight_smile:

1 Like

Thanks - and indeed I found that I did something similar in an older project.
I just wondered if there is a Hugo built-in feature nowadays that I might have overread in the docs …