Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

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

Breadcrumb question


4 Posts   1731 Views


24 February 2010 at 3:31am (Last edited: 24 February 2010 3:35am), Community Member, 98 Posts

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.


24 February 2010 at 2:38pm Forum Moderator, 5511 Posts

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/ <p>$Breadcrumbs</p>

You could add home like

<p><% if URLSegment = home %><% else %><a href="home/">Home</a> &raquo; <% end_if %>$BreadCrumbs</p>


25 February 2010 at 3:32am (Last edited: 25 February 2010 7:44am), Community Member, 98 Posts

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

Thank you so much for your help!


25 February 2010 at 7:50am Community Member, 98 Posts

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!