Try our conversational search powered by Generative AI!

Creating a BreadCrumb Trail

Vote:
 

Hello EpiServer World.

This should hopefully be an easy one for you guys - but as a front end developer being made to work on back end development, its proving a little more difficult for me...!

Can anyone explain, in simple terms how to create a menu structure in the form of a basic sitemap - have tried playing around with the PageTree functionality, but can't really get it to display what I want...

Look forward to your reply.

Cheers.

Marc.

#56869
Feb 14, 2012 12:55
Vote:
 

Take a look at the Breadcrumb.ascx control (I think) in the Demo templates. Basically it is just based on a loop which crawls the page tree using the PageData.ParentLink property from the current page to the start page and records every page it passes. This list of pages is the used to render a list of links using a PageList control, Repeater control etc.

#56870
Edited, Feb 14, 2012 13:23
Vote:
 

Hi Magnus,

Many thanks for that, very useful, and have got it working! Hoorah! The breadcrumb works, however on the homepage, it just says [Missing text /navigation/startpage for en].

I have set the homepage in the episerver.config - my knowledge of c# is basic at best, so I can't really grasp what the BreadCrumbs.ascx.cs is doing to correct this.

Many Thanks again...

Marc.

#56877
Feb 14, 2012 15:46
Vote:
 

If you look in the code you'll se that it probably uses the Translate method to get a text string instead of using the name of the start page (as it does with the other pages). It picks a text specified in one of the xml files in the site's lang folder, specifically the one in the node navigation/startpage for the language en. Look in the xml files and you'll figure out how they work. In the demo templates' lang file this node exists but you are missing it in your solution.

#56881
Feb 14, 2012 16:46
Vote:
 
#56885
Edited, Feb 14, 2012 17:10
Vote:
 

It looks in all the files for <language id="en"> and then a node navigation/startpage under that. It is common practice to use one file (named something_languageId.xml) per language.

#56887
Feb 14, 2012 17:17
Vote:
 

Hi Marcus,

I got it when you replied! It works now. Only thing is I have duplication.

So the breadcrumb reads Start / Site Homepage, rather than just site homepage.

I obviously only need one link to the homepage, not both!

Many Thanks again :)

Marc.

#56888
Feb 14, 2012 17:20
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.