forked from bricoleurs/templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
breadcrumbs.mc
34 lines (22 loc) · 833 Bytes
/
breadcrumbs.mc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<%doc>
=head1 NAME
breadcrumbs.mc - Creates breadcrumb links from the category path
=head1 USAGE
Create a utility template with the distributed code and include the created
.mc into your cover/story-templates using C<< <& /breadcrumbs.mc &> >>.
=head1 AUTHOR
Tobias Kremer & Kirsten Frste
=cut
</%doc>
<!-- BREADCRUMBS: START -->
<%perl>
my @path = ( '<a href="/">Home</a>' );
my $cat = $burner->get_cat;
my @objs = $cat->ancestry();
push( @path, map { '<a href="' . $_->ancestry_dir() . '">' . $_->get_name() . '</a>' } grep { $_->get_name() !~ /Root Category/i } @objs );
if( $element->get_name =~ /Story/i ) {
push( @path, '<a href="' . $story->get_uri() . '">' . $story->get_title() . '</a>' );
}
</%perl>
<p class="breadcrumbs"><% join( " » ", @path ) %></p>
<!-- BREADCRUMBS: END -->