Template conditionals - how to exclude tags & category pages from menu

I’m working with a Hugo theme at the moment.

At present, the tag & category are included in the page list when generating the menu.

 {{ range where .Site.Pages "Type" "!=" "posts" }}
   <li>
     <a href="{{ .Permalink }}">
       {{ .Title }}
     </a>
   </li>
{{ end }} 

I would like to extend the above to not only exclude posts, but also tags and categories. What kind of conditional logic or template code will I need to accomplish this please?

Thank you.

Perhaps .Site.RegularPages will get you what you want. https://gohugo.io/variables/site/#site-variables-list

2 Likes

That looks exactly like what I’m after - thank you.

1 Like