Warning

Laravel Breadcrumbs is no longer maintained. Please see the README for more details.

Custom Templates

Create a view

To customise the HTML, create your own view file (e.g. resources/views/_partials/breadcrumbs.blade.php) like this:

@if ($breadcrumbs)
    <ul class="breadcrumb">
        @foreach ($breadcrumbs as $breadcrumb)
            @if (!$breadcrumb->last)
                <li><a href="{{ $breadcrumb->url }}">{{ $breadcrumb->title }}</a></li>
            @else
                <li class="active">{{ $breadcrumb->title }}</li>
            @endif
        @endforeach
    </ul>
@endif

(See the views/ directory for the built-in templates.)

View data

The view will receive an array called $breadcrumbs.

Each breadcrumb is an object with the following keys:

  • title - The breadcrumb title (see Defining Breadcrumbs)
  • url - The breadcrumb URL (see Defining Breadcrumbs), or null if none was given
  • first - true for the first breadcrumb (top level), false otherwise
  • last - true for the last breadcrumb (current page), false otherwise
  • Plus additional keys for each item in $data (see Custom data)

Update the config

Then update your config file (config/breadcrumbs.php) with the custom view name, e.g.:

// resources/views/_partials/breadcrumbs.blade.php
'view' => '_partials/breadcrumbs',