Help with setting homepage and menu links

Hey guys,

I’m having a little trouble with creating a custom menu in the panel as well as setting the homepage in the config.

  1. Custom menu
    In the site.yml I have set
    sections: mainMenu: label: Main Menu Pages type: pages

    and in the template I have
    $menu_items = $site->mainMenu()->toPages();

    but $menu_items is returning nothing when dumped.

  2. Rerouting homepage
    In config I have set
    return [ 'home' => 'bonuses', 'debug' => true ];

    However, the URL for the new homepage is coming back empty sometimes, seems like it mostly occurs when trying to click back to the homepage from a sibling or child page.

A section doesn’t store anything in the content file, you need a pages field which will let you select pages.

Difference sections/fields: Kirby in a nutshell | Kirby CMS

What does that mean?

In the config I set a new homepage, but now a weird bug is happening. When I use $site->url() on a sibling or a child page to return back to the homepage it does not pass in the URL for the href. However, this is only happening on mobile.

Have you checked the source code on mobile? And what is different on mobile? Do you use a different navigation menu, maybe?

Took me all day to find this bug, but I finally found it. Turned out it had nothing to do with Kirby or my site. I was using Prepros for Live Preview and it was slightly changing the base URL. Thanks for all your help @texnixe :slight_smile: