Panel editable nested sub-menu / child-pages

Hello everyone. I’m migrating to Kirby and creating my first theme.

I’ve been able to create re-orderables pages in the backend, but I need to click to enter the page to see the subpages

However, I would like to be able to manage the menu with reorderable subpages / subitems on each of them, all in the same place, something similar to this:
gifsubmenu

Is it possible to create or replicate a sub menu / child pages nested menu functionality in the Panel?
If it is not completely possible to change what is child page and what is parent page, at least being able to reorder pages/sub-pages in the same place would be enough

Thank you

What did you do to achieve this?

The closest you can get with Kirby’s default fields is by using a nested structure field. That would at least allow you to sort the main entries manually and the secondary items within the main entry.

menusection:
        type: fields
        fields:
          menu:
            type: structure
            fields:
              level1entry:
                type: pages
              level2:
                type: structure
                fields:
                  level2entries:
                    type: pages

Everything else would require a custom solution.

1 Like

I couldn’t upload two images in the same post, but just to illustrate, what I have achieved so far is actually the default behavior of the Mægazine theme that comes with it
This is the site.yml

title: Site

columns:
  - width: 1/2
    sections:
      albums: sections/albums
  - width: 1/2
    sections:
      notes: sections/notes
      pages:
        type: pages
        create: default
        template:
          - about
          - home
          - default

And for pages it produces this behavior, when I reorder those items, they get reorder in the default’s website menu, but I couldn’t find a way to add subpages or nest it.
pagekitpages

I’m not also completely confident where in the code this reordering structure was configured, a clarification here would help a lot as well

Thats a pages section, so whats actually happening is that your are reording the pages phsycially in the file system. (Open the content folder so you can see the files on your hard drive while dragging, and you will what i mean). You are effecting the sort order of the pages.

However, with a menu, you probably dont want to effect the folders, you just want to store the desired menu order.

1 Like

This is a standard pages section and reordering of pages is available as a default setting. However, a section doesn’t allow you to have nested structures plus what @jimbobrjames said above.

That’s why I suggested the nested structure field.

1 Like