REDAXO 6
Navigation as a tree
Menus, side navigation, breadcrumbs and structured data – with nav, the successor of navigation_array.
In development: REDAXO 6 is being built in the 6.x branch of redaxo/core. The examples reflect the state of November 2026 – names and details may still change before the release.
The AddOn nav is the successor of navigation_array for REDAXO 6: Nav returns the structure as typed items (NavItem: label, url, active, current, children …) and tools to resolve it – walk(), flatten(), branch(), siblings(), breadcrumbs. The output is your code. Offline categories, those without permission and – with yrewrite – the other domains are left out; records with a detail page can appear as items below their overview. fluid builds its own menu with it.
Install nav
composer require klxm/nav:^1.0@beta
php bin/console migrate
Menu, breadcrumbs and JSON-LD
<?php
use Klxm\Nav\Component\NavBreadcrumb;
use Klxm\Nav\Nav;
use Klxm\Nav\NavItem;
use function Redaxo\Core\View\escape;
$nav = new Nav(depth: 1, exclude: [12]); // erste Ebene und eine darunter, ohne Kategorie 12
// walk(): je Eintrag Markup, $children() rendert die nächste Ebene genauso
echo '<nav><ul>' . $nav->walk(static fn (NavItem $item, Closure $children): string => '<li' . ($item->active ? ' class="active"' : '') . '>'
. '<a href="' . escape($item->url) . '"' . ($item->current ? ' aria-current="page"' : '') . '>' . escape($item->label) . '</a>'
. ($item->hasChildren() ? '<ul>' . $children() . '</ul>' : '')
. '</li>') . '</ul></nav>';
// Seitennavigation: zweite Ebene im Zweig der aktuellen Seite
foreach (new Nav(activeOnly: true)->branch(1) as $item) {
echo '<a href="' . escape($item->url) . '">' . escape($item->label) . '</a>';
}
// Brotkrumen als einfache Ausgabe, mit strukturierten Daten (Schema.org BreadcrumbList)
echo new NavBreadcrumb($nav, label: 'Sie sind hier', jsonLd: true)->render();
Options: start, depth, activeOnly, ignoreOffline, exclude, filter, data, articles, languageId, hidden. Tools: items(), walk(), flatten(), find(), branch(), siblings(), prev(), next(), breadcrumb(), jsonLd(), toArray(); simple outputs NavMenu and NavBreadcrumb.
Try it
This site is built with REDAXO 6 and fluid.
Sign in, tap “Edit” – and change every text, every image and the whole design right here.