Breadcrumbs helper for Middleman
Install the gem as usual: put gem 'middleman-breadcrumbs'
in Gemfile, then run bundle install
.
Put activate :breadcrumbs
in config.rb (not in the configure :build
block).
This gem has two configuration options, which are set in the usual way for Middleman extensions.
:separator
>
.
:wrapper
nil
, which means no wrapping.
For example, if you wanted to wrap the breadcrumb levels in <li>
elements and separate them with bullets, you would put the following in config.rb
:
activate :breadcrumbs, separator: ' • ', wrapper: :li
In your view files, just call breadcrumbs(current_page)
to display breadcrumbs. By default, this will use the separator and wrapper defined in the config.rb
file.
If you want to override the separator or wrapper defined in the config.rb
file, pass the appropriate options to the breadcrumbs
method:
<%= breadcrumbs(current_page, separator: ' ||| ', wrapper: :div) %>