Jump to:

3439 Posts in 1028 Topics by 869 members

Template Questions

SilverStripe Forums » Template Questions » Include section page in navigation

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 355 Views
  • Rodskagg
    Community Member
    8 Posts

    Include section page in navigation Link to this post

    Is there an easy way to also include the parent section page in a navigation?

    Let's say I have this structure:

    - Section 1
    - - Subpage 1
    - - Subpage 2
    - - Subpage 3
    - Section 2

    If I'm on Subpage 2, or pages below this page, I want the navigation to show:

    • Section 1
    • Subpage 1
    • Subpage 2 (marked as active)
    • Subpage 3

    But Menu() only lists the sub pages. Do I have to "manually" include the section page in the nav, or is there a setting, or parameter, of some kind I can use?

    At the moment, I'm writing out the link to the parent section using Level(1), which sort of works, but surely there must be a better way to handle this scenario?

    (Also, I'm having difficulties marking the current page/section as active. I set .current and .section links to bold, but if I'm on for example Subpage 2, both this page and the link to Section 1 will be bold, since the Subpage 2 link will have the .current class, while the Section 1 link has the .section class. And if I'm on a page below the Subpage 2 page, both the Subpage 2 and Section 1 links will have the .section class, and therefore both marked as active/bold.)

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.