Breadcrumbs Script


By: Paul Hirsch

A half-year ago, I tasked myself with creating a script that could use the folder structure of a site to create breadcrumbs (a path of links that leads to different levels of a site, based on the location of a given page) automatically. I did this in JavaScript because originally the script was to be released within a CBT system that needed to be packaged as a download and/or delivered on a CD. This meant no server technologies could be employed.

I created a script that served the needs of the CBT system well, but I wanted to see if I could "universalize" it, make it generic and viable for any site, online or off. I spent the next half-year tweaking it a little here and there until everything fell into place. The final touch just went into the script - handling jump links within the breadcrumbs.

The neatest part about this script is that it encourages site authors to use naming conventions that are friendly toward search engines. Once the author has created this friendly and fairly intuitive folder/file structure, placing the breadcrumbs into the site literally takes seconds. It is extremely easy to use, and the script itself is not too difficult to modify either.

A word of caution: JavaScript is an optional browser technology. While the vast majority of Internet users have this technology available and enabled, this breadcrumbs script should not be used as a replacement for primary site navigation. It should complement it.

Here is the script for your scrutiny and use:

---

Download the script without line-by-line notes - Best for live site integration.

Download the script including line-by-line notes - Best for examining, learning from and adding to the markup.

Live Demo

---

I will post the live version within this article in a moment.

Enjoy the script, and use it responsibly!


Paul Hirsch

**********

Paul Hirsch is one of the site administrators for IWDN and a partner/owner of Equentity, LLC.

Republished with written permission from the author, Paul Hirsch [http://www.iwdn.net/showthread.php?t=4318]