Custom sort for autogenerated groups #3280
jiv-ropo
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What version of
starlight
are you using?0.34.4
What is your idea?
Allow a custom sort function for autogenerated groups.
Why is this feature necessary?
We have numbered page slugs like: ID-1, ID-2, ID-3... This works fine until I hit ID-10 and the ordering will be: ID-1, ID-10, ID-2...
I can add this to the frontmatter of each page:
This is not preferable, because we need to update the slug and the order value separately.
I tried to add the order value logic to the frontmatter via RemarkPlugin and routeMiddleware. This didn't work because the navigation system seems to read the frontmatter before the RemarkPlugin or routeMiddleware.
Suggestions:
node_modules/@astrojs/starlight/utils/navigation.ts -> sortDirEntries()
.I like option 1 more as it seems more flexible. I don't know if it's technically feasible.
Do you have examples of this feature in other projects?
No response
Participation
Beta Was this translation helpful? Give feedback.
All reactions