tags:

views:

23

answers:

1

Hi, on my Umbraco site I have a few top level pages (about us, what we do, etc) and within these pages there are a handful of sub pages. How would I go about getting the name of the top level section (eg about us) whilst on a page within that section?

For example, If I am at http://www.example.com/about/subpage, How would I get 'About' to display? Reason being it's the heading of my sub page navigation.

Thanks!

+1  A: 

Simply create an XSLT macro which walks up from the current page to the parent (or for more flexibility the node at a certain level)

It's pretty simple xpath and XSLT:

Example 1 - xpath for getting parent page name:

$currentPage/../@nodeName

Example 2 - xpath for getting an ancestor page at certain level name:

$currentPage/ancestor::node[@level=1]/@nodeName

You can find out more about Umbraco and XSLT here:

http://our.umbraco.org/wiki/reference/xslt

For more info in general about xpath and xslt look here:

http://www.w3schools.com/xsl/

Tim Saunders
Perfect, thank you very much!, and thanks for the links too :)
Probocop