Menu weight and other oddity

Have something changed from 0.18.1 to latest that will cause menus weight to stop working? I had to revert to 0.18.1 because of that. I was also getting a WARNING: Page's Now is deprecated and will be removed in a future release. Use now (the template func). (using after-dark theme).

Thanks!

Re. menu weight: Hugo 0.19 fixed a bug where zero (i.e. unset) weights would come up on top. Now menu sorting is in line with the other collections in Hugo. So, given the 4 items with weights: 1, 3,4,0 – two menu items with 0 will be ordered by name.

As to the other error, the message is crystal clear, but I guess you will have to wait for it to be fixed in the theme. And it is just a warning.

Thank you, @bep. My menus have a 0, 1, 2 weight, yet, they are been sorted alphabetically. With 0.18.1 they will follow the numeric order. Is there a way to make them behave like that? That is, 0 goes first, then 1, then 2, and so on?

As I said, you need to start the weight on 1 (0 is nil, i.e. not set).

3 Likes

Is this documented anywhere in the docs? (I couldn’t find it)

I had the Home (_index.md) with weight 0 and other sections with higher weights and I could not figure out why Home did not appear first in the list. You know, we are used to start with 0…

It just says that 0 is the default weight, so far as I can see. Please improve the docs by adding that info.

The notion that everyone should “add to the docs” whenever they feel the need seems odd to me.

Does some one or some group moderate the additions for correctness? I think many people asking for support get help and find their answer, but feel less than comfortable submitting formal documentation on something they just learned.

It seems to me, the expert providing the solution should submit the Doc change while fresh in mind, if they have the time.

It would probably take less time than asking the learner to contribute. :grinning: