Determining a Navigation Route

At the top of each of my Web pages, I’d like to put something similar to what’s at the top of this forum page:

SitePoint Forums > Forum Index > Design Your Site > Web Page Design

I’m not even sure what this is called. Maybe a “navigation bar”? Anyway, the problem is that my menu structure is such that there are different paths by which one could end up on the same page. Therefore, the “navigation bar” cannot be simply a static line printed on the page.

Is there some way to keep track of the specific menu links used by a visitor to arrive at a specific page? Then if I had access to that chain of links, I could dynamically print whatever sequence of links were used on the page when it opens. Maybe this would require JavaScript. I wasn’t sure, so I just posted my question here.

Thanks so much.

Ken

Alex,

Thanks for the reply. Yes, I could do what you suggest–and if I give up on this quest, might end up doing something similar. However, if I understand you correctly, what you said I don’t want is just what I did want:

“…the last thing you want is a 100 page trail of links leading to something.”

I had wanted the actual “trail of links” because basically my Web site in question is divided into two parts. From the home page, one can go to either of two “sub-home-pages,” so to speak. But each of those two sub-home-pages have links to some pages relevant to both parts. Therefore, I wanted my navigation trail to make it easy for the visitor to get back to the specific sub-home-page that he actually started from. That’s why I wanted to include a trail of actual links at the top of each page.

But the pages common to both parts of the site would actually have two possible paths to get to them. Is there a way to “collect” the actual links used by the visitor to arrive at a particular page and then “dynamically” print them on that page when it loaded for that instance?

Ken

Yes, precisely, it’s called breadcrumb navigation, the best way to implement it that I’m aware of would be to hand code it into each page as often, people navigate to pages in different ways and the last thing you want is a 100 page trail of links leading to something. You simply want to list the structure in respect to how it can be navigated too in the shortest time possible (categorised appropriately). Off the top of my head if you want an automated solution, why not grab the structure via your websites sitemap and use that to parse and determine how the breadcrumbs should be formatted? :slight_smile:

The best way I can think of would be to pull the hierarchy of your website in from a sitemap and then build the link list up from the matching URL to the parent. :slight_smile:

Stevie,

Thanks for such a thorough discussion. Yes, you made some good points in the discussion of your second “more common” method. I think you’re right: showing the page in the structure of the Web site is better because, as you say, a search engine might get a visitor to a deep-level page. In what I had in mind, there wouldn’t be any links to show in a “return” path!

The problem you mention in your last paragraph can easily be handled for my structure. There are really only two possible paths to get to these “common” pages that fit in both subdivisions of the site. I’ll simply show both paths back to the main home page. I think that will solve all the problems–and be much easier than trying to dynamically save a bunch of links that in some cases might not even exist.

Thanks again.

Ken

That type of navigation is called a “breadcrumb trail”, although ironically that name doesn’t describe its normal usage.

There are two ways to set up a breadcrumb trail.

The way you have described fits the name better, because it gives a route back where the user came from. This is not easy to set up - I wouldn’t have a clue where to start - but the usual way is with cookies. However, before you get disappointed, this is actually a pretty useless navigation option. Why? Because people can already trace their route back through a site, using one of the most standard and widely-used features of their browser - the Back button. They don’t need the website to tell them which pages they’ve looked at, they can just keep hitting the Back button to see them.

The more common (and more useful) setup is to have the breadcrumb trail showing the position of the current page in the hierarchy of the site, and the route back to the home page. So if you were looking at a page about pizzerias in London, the breadcrumb trail might say:
TravelButler > England > London > Restaurants > Italian
and it would say this regardless of how you got to the page. This is far more helpful to visitors, many of whom will likely have landed at that page from a direct link or search engine. And maybe that page isn’t exactly what they want. By showing the breadcrumb trail, they can see what the next stage up is, and they can also envisage alternatives to each branch. So maybe they have now changed their mind and fancy a curry - if they click on the “Restaurants” link in the breadcrumbs, it’s still within “London” so they are in the right geographical area, and the odds are that if “Italian” was one of the choices, “Indian” will probably be another. Then maybe they’re looking for other things to do in London, so they click on “London” in the hope of finding accommodation, or travel advice, or museums and art galleries, etc.

The point is that having this kind of quick view of where you are in a website helps visitors to find their way around much better than if they have to use a more general site navigation - particularly when they arrive straight into a deep-level page without going through the hierarchy of the site.

OK, so you say that there may be multiple routes to a particular page. That’s true, to some extent, on most sites. The purpose of the breadcrumb trail is to show where a page fits in the site’s structure. If your site architecture is more of a web shape than a tree shape then that could be difficult to describe, and that kind of navigation tool may not be appropriate.

If you show a navigation chain, it’s usually referred to as “breadcrumbs”.

Are you looking to keep track of history, or categories and sub-categories?

Just a list of menu links (i.e., pages, all found on my Web site), that a visitor followed to get to any specific page on the site, starting with the home page and ending with that specific page. Just like this line,

SitePoint Forums > Forum Index > Design Your Site > Web Page Design

shows the links (pages) followed to get from the “SitePoint Forums” page to the “Web Page Design” page using the menu items.