getgrav / grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony
https://getgrav.org
MIT License
14.58k stars 1.41k forks source link

Custom menu not working when running in Modular mode. #3522

Open stianmathisen opened 2 years ago

stianmathisen commented 2 years ago

I'm trying to utilize Modular in my home page to have an easy way to structure content when people visits my domain.com. I don't want the navbar to have the modules, instead, I want to use the nav bar for more in-depth pages since the modules in the home page only touches each section briefly.

Since only modules show up in navbar when running in modular structure, I have disabled them so they do not show up in the navbar, and I'm trying to adjust the navbar myself using the site.yml's "menu" feature.

I have set the menu in site.yml like this:

menu:
    - text: Home
      url: https://domain.com
    - text: Vision
      url: https://domain.com/vision
    - icon: Products
      url: https://domain.com/products

When I make home page Default instead of Modular, Home, Vision and Products is visible and clickable. When I switch the page back to Modular, Products disappear and everything else in the menu turns unclickable.

Versions: Grav: Grav v1.7.27.1 - Admin v1.10.26.1 Themes: Latest version of Quark and Antimatter. Webserver: Litespeed PHP: 8

I been at this for weeks, and been struggling with it. There is a big chance I'm just stupid and the problem is PEBCAC, but any input on this would be greatly appreciated.

Thank you for developing this amazing tool, I love utilizing GravCMS for my projects.

stianmathisen commented 2 years ago

Update: It appears like it works completely as expected on phone, but not when using desktop/laptop.

pamtbaau commented 2 years ago

Below is about Quark only, since I do not know Antimatter.

About menu-items defined in site.yaml: Menu-items defined in site.yaml are only used when onpage_menu is set to true in frontmatter of modular.md. These menu-items are supposed to point to elements in the current page. Since the "urls"s you provide do not exist as ID's of elements, there is no scrolling and hence it seems the links are "not clickable".

On small devices, the navigation menu is not using the onpage_menu and menu-items defined in site.yaml. It uses the menu as designed in default pages. I don't think this is intended behaviour and might be something for the devs to look at.

How to show links to other pages in menu of Modular page: To disable the links to page sections in a modular page, you should set onpage_menu: false in the frontmatter of modular.md. It will then show a menu like a default page does: Links to the toplevel pages..

NB. This is not a Grav core issue, but related to a theme. The issue should therefor have been created in the repo of the specific theme.