congo icon indicating copy to clipboard operation
congo copied to clipboard

Hugo Menu Params Not Respected

Open milannankov opened this issue 2 years ago • 2 comments

What happened?

I am trying to use some of the available Hugo menu parameters (https://gohugo.io/content-management/menus/) but they do not seem to work. That might be expected but the documentation references the Hugo docs and I would expect those parameters to work.

I am specifically trying to add a 'pre' and a custom class to a menu item like shown in the Hugo documentation.

  identifier = 'about'
  name = 'about hugo'
  pre = "<i class='fa fa-heart'></i>"
  url = '/about/'
  weight = -110
  [menu.main.params]
    class = 'highlight-menu-item'

And this is what I have:

[[main]]
  name = "Some name"
  pageRef = "page"
  weight = 11
  pre = "<i class='fa fa-heart'></i>"
  post = "<span class='alert'>New!</span>"
  [main.params]
    class = 'highlight-menu-item'

Is this limitation expected or it is an issue?

Theme version

v1.18

Hugo version

v2.3.1

What browsers are you seeing the problem on?

Microsoft Edge

Relevant Hugo log output

No response

milannankov avatar Aug 14 '22 07:08 milannankov

Thanks for the report. Currently the theme does not support the pre and post menu parameters as I'm not sure what value this would add. For instance, where in the HTML should the pre be inserted? Should it be immediately before the name inside the link? Or would it go before the <a> tag and inside the <li>, or would it go before the <li>?. The issue with this sort of parameter is that everyone's use case is different.

For your example of adding FontAwesome icons, where would you expect the pre param to be inserted into the HTML? I guess it depends on whether you want the icon to be clickable.

With regards to the class param, this is not a standard Hugo parameter and would be something you would need to add to your own custom menu template.

jpanther avatar Aug 18 '22 05:08 jpanther

This issue has been automatically marked as stale because it has not had any recent activity. If you are still experiencing this issue, please review the issue history and add a reply with any requested and/or additional information in order to keep the issue open. This issue will automactically close in 14 days if no further activity occurs.

github-actions[bot] avatar Sep 18 '22 04:09 github-actions[bot]