Thanks both. I think Iḿ pretty close to what I need.
I finally have separated the menus.yml
title: Menus
sections:
menus:
type: pages
template: menu
layout: cardlets
and menu.yml
title: Menu
sections:
menus:
type: fields
fields:
menu:
type: structure
fields:
menuHeadline:
type: text
label: Menu headline
menuItems:
type: pages
label: Menu item
from the site.yml
title: Site
sections:
pages:
type: pages
layout: table
search: true
areas:
extends: sections/areas
Now this is how the setup looks like in the back end:
What I still don’t have figured out is how can I access this menu data from the front end.
At the moment I’m testing it on the: kirby5plain/site/templates/default.php
<?php $menus = $site->menus()->toStructure(); ?>
<?php if ($menus->isNotEmpty()): ?>
<?php foreach ($menus as $menu): ?>
<?php $menuItems = $menu->menuItems()->toPages(); ?>
<?php if ($menuItems->isNotEmpty()): ?>
<nav class="footer-menu">
<h4><?= $menu->menuHeadline()->html() ?></h4>
<ul>
<?php foreach ($menuItems as $menuItem): ?>
<li><a <?php e($menuItem->isOpen(), 'aria-current="page"') ?> href="<?= $menuItem->url() ?>"><?= $menuItem->title() ?></a></li>
<?php endforeach ?>
</ul>
</nav>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>
<h1><?= $page->title() ?></h1>
$site->menus() does not show anything.
Thank you again for your help.
