Breadcrumbs are the site navigation of choice for a lot of sites. It helps visitors know where they are on your site and allow them to easily find the homepage and the upper layer of the current page. Breadcrumbs are also great for those sites with tons of links within the content pages.
Breadcrumbs are also great as a secondary site navigation. I love having both the site structure and breadcrumb. It helps the user easily find what they are looking for, fast, throughout the entire site.
Not only this, but breadcrumbs are great spider food.
The downside of breadcrumbs is the lengthy amount of time typing in every single link back to the homepage and every layer above it. This is why PHP along with other scripting languages are great. You can automate the entire process by just adding a simple tag to each page.
Method One:
<?
if (isset($folder) && !isset($folder2)) {
echo "<a href=\"/\">Home</a> > <a href=\"./\">$folder</a>";
}
if (isset($folder) && isset($page) && isset($folder2)) {
echo "<a href=\"/\">Home</a> > <a href=\"../\">$folder</a> > <a href=\"./\">$folder2</a>";
}
?>
With this method, you enter this entire code within your header.php file, then in each page add the folder variables:
<?
$folder = 'Internet Marketing';
$folder2 = 'SEO';
include('header.php');
?>
For each extra layer you must add additional code, just follow the same procedure as the above code has and it will work.
Method Two:
Method two is a little different. In this instance, you will only have to add a single line to each page instead of the additional variables. It offers little control over the layer names as it takes each name from the directory.
A great place to start reading about it and for an example, view HTMLForums post titled, Making a breadcrumb in PHP
Method Three:
Method three is not unlike method two, but gives you more editorial power. You only need to add a single line of PHP to each page, but you will have plenty of work to do before hand.
With this method you give each directory a name (if you want it to have one different), then it spits out the breadcrumbs. You will have to do some editing with the code given in method two, but it might be worth while if you have obscure folder names.
Method Four:
Give each page a layer, not specifically within a directory. This is good for sites with only one level on their domain (like many blogs are doing now). Instead of showing http://example.com/tomatoes.htm and http://example.com/beef.htm with only Home as the breadcrumb, it would add Home > Veggies and Home > Meat into the layers.
With this method you will have to do quite a bit of editing with method two. You might even be better off if you just use method one.
Summary:
There are many ways to go about creating your own breadcrumbs and there is no one best way to do it. It depends on the type of site and the name of the sites directories and if you use dynamic or static URLs.
Whatever method you choose, just be sure you know what you are doing.
Written: Jun 9, 2008
Tags: breadcrumbs, internal linking, search engine marketing, search engine optimization, sem, seo








Dennis Edell

June 9, 2008 @ 7:49 pm | Reply
Miles over my head right now, but great reference material for down the road.
Thanks!