Problems Menu builder cookbook examples

Hi,

I’m very new to kirby and so far I’ve managed to customise the main panel dashboard a little and created a few templates and tinkered with blueprints a little so I can have a selection of layouts and blocks just so I can begin to formulate how I’d like to structure content in pages etc… so far so good. I started learning Kirby a while ago but then found myself side tracked by other things so I’m essentially starting from scratch again.

Now I’m looking into getting some menus working and I don’t want to hard-code them. This brought me to Menu builders | Kirby CMS now I’ve probably missed out some crucial information somewhere, but I’m unable to get any of the examples to work.

From reading Menu builders | Kirby CMS it seems that I have to put the snippets into site.yml so I started there

Here is my site.yml in case you’re wondering

columns:
  - width: 1/2
    sections:
      articles: sections/articles

  - width: 1/2
    sections:
      pages:
        type: pages
        create:
          - default
          - fulltext
        templates:
          - about
          - home
          - default
          - pricing
          - fulltext

So I thought I’d add in :


    mainMenu:
      type: pages
      label: Main menu pages

to the second column you see there and I get a list of pages cool, I thought, but the template output example doesn’t work, Oh, hmmmm so there’s something else I’m missing then. I re-read and noticed this line “The easiest way to create a custom menu from existing pages is the use of a pages field:” I then went down the rabbit of hole of trying to use the field I got that work display a list of pages I could select (yay) but then the output example in the template still did work, so clearly this isn’t the way after all but does that go into site.yml file or elsewhere?

This brings me onto the second example in menu builders Multiple independent custom menus this simply doesn’t work at all and again where do I put the code to make it work if I place it under sections I get the following error message in the panel " Invalid section type (“structure”) "

I do understand that if one copies and pastes you don’t learn but at the same time giving no clue as to how to make it work is very frustrating and i’ve so far spent several frustrating hours doing a lot of reading and I’m still none the wiser, I’m willing to except I’ve done something stupid or I am in fact too stupid.

I’m very happy to add to the tutorial if you’ve not got time, but I do need to know how this works first

Sorry, struggling user.

Unfortunately, I don’t quite see from your example where exactly you added the field. But since it is a field and what you currently have in your site.yml are two sections you need to add a fields section first to add fields to this setup.

 - width: 1/2
    sections:
      pages:
        type: pages
        create:
          - default
          - fulltext
        templates:
          - about
          - home
          - default
          - pricing
          - fulltext
      fields:
        type: fields
        fields:
          mainMenu: 
           type: pages
           # ect.

Ahh, I see, the bit about the fields is the bit that was missing. I had no idea how to implement that, I think it might be worth adding to the tutorial.

So I guess with creating multiple menus that similarly needs to go inside a fields block.

On the subject of fields how do I place multiple collections fields into different sections when I tried to add fields to different sections I got nothing displayed only some empty boxes with “fields” written in them

Sorry, I don’t understand your question… Can you please rephrase?

How to add fields to a blueprint is part of the basics, which we don’t want to repeat throughout the docs.