I’m running the hugo-learn-theme ( not sure whether there are newer ones that are recommended to get into hugo?) and I’m trying to figure out how my submenu items are ordered.
I’ve set weights for my main menu items, so I obviously don’t want to switch to SortByTitle in the Site.Params / config.toml
I’ve assumed that once no weights are given to my pages, hugo would default to alphabetical listing, but that did not happen, rather I found an order like this:
Edit: mahoromax / anonym-stories · GitLab trimmed repository clone for local testing. See the “Church” menu entry’s submenu items.
I renamed “Community” to “Choir” in the anonymization process.
[Main menu item]
Community B…44
Ing…
Community M…44
Community B…42
Community S…
I’ve looked into the dates, linktitle, description. Some items (the second Community B and leo… are pages with folder/index.md while the others are just title.md or /folder/title.md
But the order in the submenu does even split the two pages that start with Community 44.
So the questions I have are:
Can I sort the submenu differently than the main items?
Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.
If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.
I was thinking about it, but since I was interested in the principle - not a practical solution to the example, I did skip it.
Here is a anonymized repo of this project (deleted images and probably broke lots of stuff, but it does redner with hugo serve - the CI/CD won’t work I suppose.
I learnt something new today. I had to ‘hack’ a completed project that needed a few articles before others arranged by weight. The negative weight will come in handy.
Thank you for the answer. I indeed did not find where it the order was decided - I did figure out to add weights to create an order though, but I forgot to add it to the original post.
What I think is still unanswered is: what is the order that happened when I did not use weights on the second level ? What did Hugo default to then?