NAME
Mojolicious::Plugin::Breadcrumbs - Mojolicious plugin for autogenerating breadcrumbs links
SYNOPSIS
#!perl
use Mojolicious::Lite;
plugin 'Breadcrumbs';
get '/user/account-settings' => 'account-settings';
app->start;
__DATA__
@@ account-settings.html.ep
You are at <%== breadcrumbs %>
The output in the browser then be this (actual output will not have line breaks):
You are at
<section class="breadcrumbs">
<a href="/">Home</a><span class="breadcrumb_sep">▸</span>
<a href="/user">User</a><span class="breadcrumb_sep">▸</span>
<span class="last_breadcrumb">Account settings</span>
</section>
By default, /
path will be named Home
, and all other paths will be named by changing -
and _
characters to spaces and capitalizing the first letter. You can provide your own mapping for certain paths, by passing a mapping hashref to breadcrumbs
helper. Anything not found in the map will still be named as described above.
#!perl
use Mojolicious::Lite;
plugin 'Breadcrumbs';
app->breadcrumbs({
'/' => 'Start page',
'/user' => 'Your account',
'/user/account-settings' => 'Settings',
});
get '/user/account-settings' => 'account-settings';
app->start;
__DATA__
@@ account-settings.html.ep
You are at <%== breadcrumbs %>
The output in the browser then be this (actual output will not have line breaks):
You are at
<section class="breadcrumbs">
<a href="/">Start page</a><span class="breadcrumb_sep">▸</span>
<a href="/user">Your account</a>
<span class="breadcrumb_sep">▸</span>
<span class="last_breadcrumb">Settings</span>
</section>
DESCRIPTION
Mojolicious::Plugin::Breadcrumbs is a Mojolicious plugin for auto-generating breadcrumbs.
METHODS
Mojolicious::Plugin::Breadcrumbs inherits all methods from Mojolicious::Plugin and implements the following new ones.
->register()
$plugin->register(Mojolicious->new);
Register plugin in Mojolicious application.
HELPERS
breadcrumbs
Using in HTML:
You are at <%== breadcrumbs %>
Setting custom link names:
app->breadcrumbs(
'/' => 'Start page',
'/user' => 'Your account',
'/user/account-settings' => 'Settings',
);
See SYNOPSIS for full description of use and arguments.
REPOSITORY
Fork this module on GitHub: https://github.com/zoffixznet/Mojolicious-Plugin-Breadcrumbs
BUGS
To report bugs or request features, please use https://github.com/zoffixznet/Mojolicious-Plugin-Breadcrumbs/issues
If you can't access GitHub, you can email your request to bug-mojolicious-plugin-breadcrumbs at rt.cpan.org
AUTHOR
LICENSE
You can use and distribute this module under the same terms as Perl itself. See the LICENSE
file included in this distribution for complete details.