Use Hugo built-in menu functionality
pmviva opened this issue · 3 comments
I think is better to use Hugo built-in menu functionality instead of having an array of navlinks in site params.
This has two benefits:
- You get the links ordered by weight without any extra code
- You can add pages to menus by defining an attribute in front matter
Here's an example:
---
menu: ["main", "footer"]
----
I think it's possible to have both the option for navlinks in site params and in front matter. I have a weak memory of doing that for Hugo-bootstrap-premium...
You can have navlinks defined in front matter of the page. The thing is that the params you define in front matter doesn't merge with the ones defined in confg.toml
So you can't have some links defined in config.toml while some others defined in front matter and iterate over them in one single loop.
Besides, I think it's better to use the built in functionality provided by Hugo. It orders the links by weight by default and makes an easy migration path for an existing site that already uses Hugo menu functionality.
I was looking at the theme's code in order to make a pull request, but confused me some of the handling of the navlinks, for example it defines a link for Home and then if there's a home navlink defined in config.toml it skips it. It also uses different classes for navlinks.
Thanks for the PR!