Breadcrumbs with SSI


I don't update my own webpage frequently enough nor do I have sufficient dynamic content to warrant the bother of writing everything as a CGI or PHP script, but there are two common components I'd like to pull in as needed: the footer, with timestamp and standards-conformance declaration, and a navigation bar of some kind. Server-side includes (SSI) are supported by my hosting provider, and were invented for just such a purpose, so I decided to use them.

The footer, being a static element, offers few obstacles, but try as I might I couldn't find a prepackaged solution for adding breadcrumb navigation (my chosen style) via SSI. So I invented one; a skanky little hack that still does the trick.

How Does It Work?

My scheme is predicated on the use of a <meta> tag and two scripts. In the header of each page that is to leave a trail, one puts something like the following:

<meta name="crumb" content="Differential Widgets"/>

One also puts an SSI #include similar to the following in one's page at the place where the trail is to be generated:

<!--#include virtual="/path/to/breadcrumb.cgi"-->

One then executes the following: <website-root> generates a DBM file that maps URIs to breadcrumb names; the breadcrumb.cgi script fetches names as necessary out of that DBM file and generates the links that make up the breadcrumb trail.

breadcrumb.cgi wraps its breadcrumb trail in a <div> with an id attribute of "crumbs". You can format your breadcrumb trail by adding a rule to your CSS for said <div>.

Where Do I Get It?

The breadcrumb scripts are written in Python, so you will need the Python interpreter installed to use them. They should work with version 2.2 and higher.

Download the current version.

Bugs/Needed Enhancements

  • Imports dbm rather than anydbm; this should be corrected for proper portability.
  • The base-URI component should be specified through a command-line option rather than through the baseUri variable in