forestryio / jekyll-menus

A menus (site navigation) plugin for your Jekyll website that also works with https://forestry.io (Jekyll CMS)
MIT License
134 stars 27 forks source link

Submenus #4

Closed tech4him1 closed 7 years ago

tech4him1 commented 7 years ago

Do you have an example on how to create submenus? I can't seem to get them working.

envygeeks commented 7 years ago

Hi @tech4him1 you can read: https://github.com/forestryio/jekyll-menus#recursive-menu-output for how to output recursive sub-menus.... as for how to label them, you just create your own identifier (https://github.com/forestryio/jekyll-menus#customizing-the-identifier-on-an-item) and then attach menus to them... or if you rely on our system (which is the slug of the page so this-is-my-page.html -> this-is-my-page just attach them to the slug. Jekyll menu's is a flat-menu system (like Hugo) so all identifiers are on the root, regardless of their position in any given menu, our drops are design to seek this out for you so each menu has a children method that can be used to seek out data.

# about.html
menus: main
# about/page.html
menus: about
# about/page/sub-page.html
menus: page
tech4him1 commented 7 years ago

OK, I still cannot seem to get it working. I put together a quick demo site of how I am trying to do it, would you mind pointing out how I am doing it wrong?

https://github.com/tech4him1/jekyll-menu-test

In the test repo, I am trying to list the menu within index.html.

protegh commented 7 years ago

I have this problem, too. Can you please give us a working example.

protegh commented 7 years ago

Found the reason why the example of tech4him1 is not working: The implicit identifier of a menu item in page about.html is not about but _about. And the implicit identifier of a menu item in page folder/index.md is folder_index.

So either one has to use these implicit identifiers in subitems or set them explicit.