I have recently started a project using Umbraco, and implemented a site menu using navigation model described in codeshare blog.
The below snippet works up till level 2 navigation , however I want to extend it to level 3 navigation.
One option is using the preconfigured "site map" partial in Umbraco - this I often use for multi level navigation.
To give it a spin:
Go to the settings section
Right click on Partial Views and click "Create"
Then "New Partial View from Snippet"
Select "Site Map"
Enter a name and click "Save"
Line 25 controls how many levels deep your navigation goes.
The one consideration in using this if you need to add customisation for the different levels, ie CSS classes. I often amend the "traverse" helper function and pass in an additional parameter.
Umbraco site menu navigation model
Hi,
I have recently started a project using Umbraco, and implemented a site menu using navigation model described in codeshare blog. The below snippet works up till level 2 navigation , however I want to extend it to level 3 navigation.
@helper RenderSubItems(List
} }
}
Also I want to implement in the menu, if level 2 is further expandable to level 3, level 2 should not be navigable, but just a container for level 3.
Please help in this regard.
Hi Sidz,
I notice in the codeshare example the decision on whether a sub-navigation level should be added or not is controlled by the 'HasChildren' property:
This would suggest that anytime there are children under a node they will be rendered regardless of level.
In your example there is a 'HasSubNavigation' property controlling this functionality - does this differ from the HasChildren of the original?
Hi Derek,
My HasSubNavigation has the same definition
How to change the snippet in my partial view to render for third level?
Hi Sidz
One option is using the preconfigured "site map" partial in Umbraco - this I often use for multi level navigation.
To give it a spin:
Line 25 controls how many levels deep your navigation goes.
The one consideration in using this if you need to add customisation for the different levels, ie CSS classes. I often amend the "traverse" helper function and pass in an additional parameter.
Cheers
Nigel
Hi Nigel,
My requirement to extend this site menu model to multi languages having separate nodes in umbraco back office for each language
Hi Derek
The sitemap will work fine for this scenario as it gets the "home" node and reads from there.
Cheers
Nigel
is working on a reply...