Per Design

Mostly musings on design

Per Design

Nearly automatic breadcrumbs

Breadcrumbs

var here = location.href.replace(/(\?.*)$/,'').split('/').slice(3);
var parts = [{ "text": 'Home', "link": '/' }];

for( var i = 0; i < here.length; i++ ) {
   var part = here[i];
   var pageName = part.toLowerCase();
   pageName = part.charAt(0).toUpperCase() + part.slice(1);
   var link = '/' + here.slice( 0, i + 1 ).join('/');
   $('#siteBreadcrumb ol.breadcrumb').append('<li><a href="' + link +'">' + pageName.replace(/\.(htm[l]?|asp[x]?|php|jsp)$/,'') + '</a></li>');
   parts.push({ "text": pageName, "link": link });
}

Generates breadcrumb links based on the URL/path of the document (this code currently requires jQuery).