hugo-theme-docdock
hugo-theme-docdock copied to clipboard
Feature request: Add theme setting for default sorting of menu entries
Hi @vjeantet
With the recent content organization, my navigation entries don't seem to be sorted alphabetically like it used to be. I do no specify the weight
attribute.
I am using Hugo version 0.25 and your theme at commit 5869299972c981931908be24b0f378039197e2d4. My entries used to be sorted alphabetically but now it looks like it's sorted by date.
If no weights are provided (or if weights are the same), date will be used to sort https://gohugo.io/content/ordering/
Cheers
Update
I just found a way to do it by changing {{ range $pages.ByWeight }}
to {{ range $pages.ByTitle }}
in layouts/partials/menu.html.
Is there a better way to do this without having to override the whole template? Can I somehow specify it in the config file?
@vjeantet I hope you don't mind me following up on this. Do you have any idea why me menu entries are not sorted alphabetically by default?
Hello @SiamKreative I order menu entries by weight.
I will add an option into site conf to allow you to choose ordering type.
Thanks! Can't wait :)
add ordersectionsby = "title"
in your config.toml
Thanks for this! It does not seem to affect top level entries. I will fix that by setting weight on them.
I might have been slightly unclear about the expected result. Right now, it is impossible to overrides the default sorting (ordersectionsby
) using the weight
attribute. I believe we should still be able to overrides the menu entries sorting by weight.