A plugin for Kirby CMS that allows you to organize your navigation items into groups.
- Create and manage navigation groups
- Drag & drop interface for organizing pages
- Sync sort order with folder structure
- Multi-language support (EN, DE, FR, ES, IT)
- Customizable group fields
Download and copy this repository to /site/plugins/kirby-navigation-groups
composer require philippoehrlein/kirby-navigation-groups
- In your blueprint, add a field of type
navigationgroups
:
fields:
navigation:
label: Navigation
type: navigationgroups
- Optional: Add custom fields to your groups and filter pages by status:
fields:
navigation:
label: Navigation
type: navigationgroups
status: listed
fields:
description:
type: textarea
label: Description
toggle:
label: Toggle group
type: toggle
text:
- "no"
- "yes"
The plugin supports the following options:
status
: Filter for page status ('all', 'listed', 'unlisted', 'published', default: 'listed')fields
: Additional fields for groups
The plugin provides the Field Method toGroupItems()
to access the stored navigation items:
<?php
$items = $page->navigation()->toGroupItems();
?>
<nav class="navigation">
<ul>
<?php foreach ($items as $item): ?>
<?php if ($item->type() == 'group'): ?>
<li>
<h2><?= $item->title() ?></h2>
<ul>
<?php foreach ($item->pages() as $subPage): ?>
<li><a href="<?= $subPage->url() ?>"><?= $subPage->title() ?></a></li>
<?php endforeach; ?>
</ul>
</li>
<?php else: ?>
<li><a href="<?= $item->url() ?>"><?= $item->title() ?></a></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</nav>
If you want to contribute to the development of this plugin, follow these steps:
- Clone the repository.
- Install dependencies using Composer.
- Make your changes and test them in your Kirby installation.
This plugin is open-source and available under the MIT License.