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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Breadcrumb question


Go to End


4 Posts   2866 Views

Avatar
jseth

Community Member, 98 Posts

24 February 2010 at 3:31am

Edited: 24/02/2010 3:35am

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.

Avatar
Willr

Forum Moderator, 5523 Posts

24 February 2010 at 2:38pm

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>

Avatar
jseth

Community Member, 98 Posts

25 February 2010 at 3:32am

Edited: 25/02/2010 7:44am

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!

Avatar
jseth

Community Member, 98 Posts

25 February 2010 at 7:50am

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!