Skip to content

Sidebar page-tree with alphabetically sort #940

@mjaepel

Description

@mjaepel

Feature Description

The order of pages in the page tree of the sidebar should be configurable:

  • (current): byWeight
  • (additionally): byTitle

Problem/Solution

Currently, the pages in the page tree of the sidebar are sorted by weight. If no weight is defined for a page, it is sorted by date.
I understand that this is a practical use case for a number of users. However, there is another scenario in which this is very impractical:
Technical documentation with a large number of pages that should be sorted alphabetically.

Currently, there is no other option than to assign a weighting to each individual page or to fake the date.
And if you then add a page whose title begins with “B,” you have to adjust the weighting of all subsequent pages.

I would like to see the field that is sorted by be configurable via hugo.yaml. This would allow alphabetical sorting to be enforced.

Alternatives Considered

Of course, I can overwrite layouts/_partials/sidebar.html and replace “$items.ByWeight” with “$items.ByTitle”.
However, this makes it unnecessarily difficult to keep up with changes in Hextra.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions