You could simply 'hard-code' the first item using root, something like below.
Also, just to note that you probably want to null check your variables here so I've added that in to the example aswell. Finally, I'm using Children here as I'm running Umbraco 7.7 and TextPages throws an error.
Subnavigation showing parent
Hi I have a problem creating a subnavigation i razor, thats shows parent along with the childpages. I have a structure like this:
Frontpage
---- Service 2
---- Service 3
When you click on "Services", I need the subnavigation to show not only the childpages (service 1, service 2 etc.) but also the parent "Services".
I am using the standard Razor template for navigations, but I don't know how to customize it to also include the parent. Heres my Razor script:
Can someone please help me out?
You could simply 'hard-code' the first item using
root
, something like below.Also, just to note that you probably want to null check your variables here so I've added that in to the example aswell. Finally, I'm using
Children
here as I'm running Umbraco 7.7 andTextPages
throws an error.Perfect - Thats solved my problem. Thank you, Ben :)
-- Big high five --
is working on a reply...