Jump to:

23367 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » Breadcrumb question

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 1691 Views
  • jseth
    Avatar
    Community Member
    98 Posts

    Breadcrumb question Link to this post

    I had a request to make the breadcrumbs on our site go all the way back to the Home page... for example, we have the "top" pages "Home", "Human Resources", "Operations", etc. When I go to the "Human Resources" page, my customer wants to see in the breadcrumbs "Home>>Human Resources".

    I know that the link to Home is right there above in the navigation menu, but this is what they are asking for. I'm toodling around in SiteTree.php and see the stopAtPageType section, but am not quite sure if this is the right place as I changed ClassName in (!stopAtPageType || $page->ClassName != $stopAtPageType) to HomePage (the page type for our home page) but it made no change. Is it possible to do this? Thanks.

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Breadcrumb question Link to this post

    Couldn't you manually add a home link to the breadcrumbs in your template. For example in the default theme it has the following for the breadcrumbs in blackcandy/templates/Includes/Breadcrumbs.ss <p>$Breadcrumbs</p>

    You could add home like

    (themes/blackcandy/templates/Includes/Breadcrumbs.ss)
    <p><% if URLSegment = home %><% else %><a href="home/">Home</a> &raquo; <% end_if %>$BreadCrumbs</p>

  • jseth
    Avatar
    Community Member
    98 Posts

    Re: Breadcrumb question Link to this post

    Thanks, Willr. I added your code to the Page.ss file in /templates/layout/Page.ss in addition to the BreadCrumbs.ss file, and it works perfectly!

    Thank you so much for your help!

  • jseth
    Avatar
    Community Member
    98 Posts

    Re: Breadcrumb question Link to this post

    I am getting one unexpected breadcrumb on the Home page and I'm not sure where it's coming from or how to get rid of it!

    On the home page, the actual Page Name (which is Staff Home) appears (right above the $Title, which of course is the same, right where the breadcrumbs are). When I click on a sub page of the Home page, I do get a breadcrumb which reads "Home>>Staff Home>>EASTERN Forms", with Staff Home being the page's Page Name. If I change the Page Name to Home, I get a breadcrumb of "Home>>Home>>EASTERN Forms". Would you have any idea where this is coming from? All of the other pages work perfectly!

    1691 Views
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.