cancel
Showing results for 
Search instead for 
Did you mean: 

Breadcrumb path to the root

leviter
Champ in-the-making
Champ in-the-making
Hi,

We want to develop a website which has a breadcrumb, but not like the breadcrumbs which are currently in the web client.

The breadcrumb has to be automatically generated based on parent-child generation of the pages and the location of the page in the site structure. So it would reflect the path to the root and not a path of where you've been.

How can this be implemented in the site with Alfresco?
5 REPLIES 5

flin
Champ in-the-making
Champ in-the-making
It depends on how you organize your content.

The simplest way is the site to follow the repository structure. So to know the path you are in just get the parent Nodes of your current Node.

Otherwise you have to keep track of the node navigation in the user session.

eyestreet
Champ in-the-making
Champ in-the-making
Hey Leviter,

We did something like this for the Alfresco.com website.  Essentially each page that is to show up in the navigation structure has a reference in an xml file that shows who its parents, children, siblings, grandparents etc are located.  What this allows is the ability to show where you are in the navigation, as well as what "section" you are in, and what pages are related to your current page. 

The xml looks something like this:


<navigation>
   <Nav>
      <Key>home</Key>
      <Label>Home</Label>
      <URL>/</URL>
      <Shortcut key="h" />
      <SubNav>
         <Key>products</Key>

         <Label>Products</Label>
         <URL>/products/</URL>
         <Shortcut key="p" />
         <SubNav>
            <Key>1.1</Key>
            <Label>At a Glance</Label>
            <URL>/products/ecm/</URL>

            <SubNav>
               <Key>1.1.1</Key>
               <Label>Hosted Trials</Label>
               <URL>/products/ecm/hostedtrials/</URL>
            </SubNav>

In this structure you can nest out to n subnavs.  We then built some java methods to read this structure and generate the nav for the page on the fly.  Additionally, each page that calls this nav bean tells the nav bean it's key.  So in the example above if we build a page called Hosted Trials, with a key of 1.1.1 when we call the navbean we give it 1.1.1 which precisely identifies where in the site we are located.  It then determines what to display around it.  In this case, it's parent is At a glance, and grandparent is products.

I hope this helps,

Brent Kastner

leviter
Champ in-the-making
Champ in-the-making
Hey Brent,

Thanks for your answer!

My next question would then be how the xml file containing navigation information is generated. Do you do this for each generated page? If so, then I would assume that it is done with some of the form rendering functions.

– Marcel

vipul
Champ in-the-making
Champ in-the-making
Hey Leviter,

I have used request.getServletPath() method which return string, from that string i played li'l bit, i mean i  divided the strings in multiple string and generated breadcrumb values. 

e.g. Path: /Solutions/Suites/WCM.jsp
Out put :  <a href="/Solutions/">Solutions</a>
               <a href="/Solutions/Suites/"> Suites</a>
               <a href="/Solutions/Suites/WCM"> WCM </a>

Call this TRICKY method from header file, so it will apply breadcrumb in every pages.

nicolasraoul
Star Contributor
Star Contributor
Navigation is a very typical requirement, I am surprised this issue did not evolve since 2007.

Or did I miss some improvement update?
Am I still required to have generate XML files that contain the navigation information?
If yes, are there tools and sample code somewhere? (could not find using Google)

Thanks,
Nicolas