HugoBlox / hugo-blox-builder

🚨 GROW YOUR AUDIENCE WITH HUGOBLOX! 🚀 HugoBlox is an easy, fast no-code website builder for researchers, entrepreneurs, data scientists, and developers. Build stunning sites in minutes. 适合研究人员、企业家、数据科学家和开发者的简单快速无代码网站构建器。用拖放功能、可定制模板和内置SEO工具快速创建精美网站!
https://hugoblox.com/templates/
MIT License
8.36k stars 2.91k forks source link

Support for submenus? #72

Closed kepiej closed 7 years ago

kepiej commented 7 years ago

Is it possible to create submenus?

I would like to create a menu with an item "Research" and then submenus with "All publications" and "Work in progress". Ideally, clicking on (or hovering over) "Research" reveals the 2 submenus. Similarly, for "Teaching" I would like to create submenus.

The Hugo documentation mentions the use of the "parent" field to create nested menus, but this does not appear to work.

I'm still very new to Hugo, so I apologise if this is a silly question. Any help is very much appreciated.

gcushen commented 7 years ago

Academic doesn't support sub-menus. The general philosophy with the theme is to keep the interface simple, so this feature probably won't be added anytime soon.

You can customize the navigation bar for your purpose by copying themes/academic/layouts/partials/navbar.html to layouts/partials/navbar.html (relative to the root of your site). Your version of the navigation file will then override Academic's file.

kepiej commented 7 years ago

Thanks for the reply. I was able to get it working! The modification turned out to be quite simple. I now have submenus (but not submenus in submenus). They are specified using the parent field. I attach my modification for anyone interested in the future: navbar.html

gcushen commented 7 years ago

Thanks for sharing your modification @kepiej . I just tested it out - the required code changes for the feature are more minimal than I expected and it doesn't break compatibility with the existing example site menu or the active link highlighter (Bootstrap scroll spy). Thus, I've had a change of mind and will integrate it shortly 😃

kepiej commented 7 years ago

Great to hear! Happy to help and thanks for incorporating this! :)

svcuong commented 4 years ago

Thanks for the reply. I was able to get it working! The modification turned out to be quite simple. I now have submenus (but not submenus in submenus). They are specified using the parent field. I attach my modification for anyone interested in the future: navbar.html

@kepiej Please tell me after you've done navbar.html how did you make submenu in menus.toml?

rodrigoalcarazdelaosa commented 4 years ago

Thanks for the reply. I was able to get it working! The modification turned out to be quite simple. I now have submenus (but not submenus in submenus). They are specified using the parent field.

I attach my modification for anyone interested in the future: navbar.html

@kepiej Please tell me after you've done navbar.html how did you make submenu in menus.toml?

Have a look at my repo: https://github.com/rodrigoalcarazdelaosa/rodrigoalcarazdelaosa.me where I use submenus

svcuong commented 4 years ago

Thanks for the reply. I was able to get it working! The modification turned out to be quite simple. I now have submenus (but not submenus in submenus). They are specified using the parent field.

I attach my modification for anyone interested in the future: navbar.html

@kepiej Please tell me after you've done navbar.html how did you make submenu in menus.toml?

Have a look at my repo: https://github.com/rodrigoalcarazdelaosa/rodrigoalcarazdelaosa.me where I use submenus

@rodrigoalcarazdelaosa I saw it, thank you very much. But I didn't find navbar.html file in your layouts/partials/?

rodrigoalcarazdelaosa commented 4 years ago

Thanks for the reply. I was able to get it working! The modification turned out to be quite simple. I now have submenus (but not submenus in submenus). They are specified using the parent field.

I attach my modification for anyone interested in the future: navbar.html

@kepiej Please tell me after you've done navbar.html how did you make submenu in menus.toml?

Have a look at my repo: https://github.com/rodrigoalcarazdelaosa/rodrigoalcarazdelaosa.me where I use submenus

@rodrigoalcarazdelaosa I saw it, thank you very much. But I didn't find navbar.html file in your layouts/partials/?

That feature was added years ago 😉. No need to add any custom partial

svcuong commented 4 years ago

@rodrigoalcarazdelaosa I understand, thank you again 👍

7yl4r commented 3 years ago

Even after reading this issue I didn't realize this was a working feature without custom partials. I was really happy to discover it is baked in!

I think it might be good to add a "how to edit the menu" docs page to the wowchemy docs or possibly modify the example academic template to include a simple submenu so the functionality is demonstrated.