Structuring and navigating hierarchical content
To generate a navigation menu in Umbraco CMS based on the structure defined by the content editor, you typically build a Razor partial view that reflects the hierarchy in the content tree. Here’s how it works, step by step, using standard Umbraco APIs in an ASP.NET Core MVC Razor view setup.
Generating a navigation menu from structure
Let editors use the Content section to define pages like this:
- Home (allowed at root)
- About Us
- Services
- Consulting
- Training
- Blog
- Contact
Each of these pages is a content node of a document type that is allowed under Home. This hierarchy is exactly what we want to turn into a menu.
To be included in navigation, each page should:
- Have a template assigned.
- Be marked as “Visible in navigation” (optional but useful, more on this below).
- Be published.
You can add a Boolean property called something like hideFromNavigation...