thinktomorrow / chief-sitestructure
Site structure and breadcrumb assistant for Thinktomorrow/chief cms
Requires
- thinktomorrow/chief: ^0.5.11
- thinktomorrow/vine: ^0.2.6
Requires (Dev)
- doctrine/dbal: ^2.5
- orchestra/testbench: 4.*
- phpunit/phpunit: ~8.5
- dev-master
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-dependabot/composer/symfony/http-kernel-4.4.50
- dev-dependabot/composer/spatie/browsershot-3.57.4
- dev-dependabot/composer/guzzlehttp/guzzle-7.4.5
- dev-dependabot/composer/guzzlehttp/psr7-1.8.5
- dev-dependabot/composer/league/flysystem-1.1.4
- dev-dependabot/composer/laravel/framework-6.20.26
This package is auto-updated.
Last update: 2024-04-30 00:45:28 UTC
README
Chief sitestructure
This add-on adds sitestructure and breadcrumb features to chief.
Versions
Since this is an add-on for Thinktomorrow/chief that package is required.
This add-on also relies on certain features in chief so it's only supported from 0.4.6 onwards.
Installation
composer require thinktomorrow/chief-sitestructure
Run migrations, this will create the site_structure table.
php artisan migrate
Usage
To start using breadcrumbs for pages first add the BreadcrumbAssistant
to the relevant PageManager.
protected $assistants = [ UrlAssistant::class, ArchiveAssistant::class, PublishAssistant::class, BreadcrumbAssistant::class, ];
The assistant will add a field to each page to select the parent page.
Next up is creating the view for the breadcrumbs. The following is an example of a breadcrumb view. Offline pages are automaticly filtered out of the breadcrumb structure.
@foreach(breadcrumbs($page) as $crumb) @if($loop->last) <svg width="12" height="12" class="mr-2"><use xlink:href="#icon--chevron-right"></use></svg> <span class="text-sm" title="{{ $crumb->label }}" aria-current="page"> {{ $crumb->label }} </span> @else <svg width="12" height="12" class="mr-2"><use xlink:href="#icon--chevron-right"></use></svg> <a href="{{ $crumb->url }}" class="font-medium text-primary-500 hover:underline mr-2 text-sm">{{ $crumb->label }}</a> @endif @endforeach