Author image Danial Pearce
and 1 contributors


Catalyst::Plugin::Breadcrumbs - Breadcrumb information for your templates.


    use Catalyst qw/-Debug Breadcrumbs/;



        breadcrumbs => {
            hide_index => 1,
            hide_home  => 0,
            labels     => {
                '/'       => 'Home label',
                '/foobar' => 'FooBar label',




This plugin provides the ability to use c.breadcrumbs from your template to get a nice loop of the breadcrumb information.

There are some very basic configuration options for you to use as you can see above. By default both hide_index and hide_home are off.

Set hide_home to a true value if you don't want to see the root location '/' to be interpreted as part of your breadcrumbs.

Set hide_index to a true value if you don't want to see 'Index' as the last piece of your breadcrumb when you hit a path such as '/foo/', which in Catalyst, implies an 'index' action. You will almost always want to be setting this value. So much so that in future versions it may be on by default, so I suggest not relying on it being on by default, turn it on of you want it.

Use the labels hash if you aren't happy with the default types of labels. Which is pretty much ucfirst($path), but underscores will also be replaced with spaces by default. /foo_bar would default to 'Foo Bar'.


This method will return an array ref that you can iterate through in your template. It will be an array of hashrefs, each having a "path" and a "label" field.


 <ul id="breadcrumbs">
    [% FOREACH item IN c.breadcrumbs %]
        <!-- We don't want to have a link for the last
             breadcrumb, cos we are already there -->
        [% IF loop.last %]
            [% item.label %]
        [% ELSE %]
            <a href="[% c.uri_for(item.path) %]">item.label</a>
        [% END %]
    [% END %]

Will print breadcrumbs like:

 o Home
 o Admin
 o Edit

If you are like me, you will move all that into a and include it on every page that you want breadcrumbs on. I also have something like this after my breadcrumbs:

[% IF object %]<li>[% object.title %]</li>[% END %]

So that your breadcrumbs has the title of the current object you are viewing. The breadcrumbs method doesn't take care of this, it is left up to the template. You will then of course style your #breadcrumbs li { list-style: none; display: inline } in order to get them all on one line. You can alter the style to have background images and whatever you like.


Danial Pearce <>


This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.