-
-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sidebar folders order depends on their page order property #1223
Comments
I just started looking at a potential solution, but found this comment: /**
* Get the sort weight for a given route or directory. Lower numbers rank higher.
* Directories have the weight of the lowest weighted route they contain.
*/
function getOrder(routeOrDir: Route | Dir): number { for the This still look like a problem for me, as I don't want to check potential impact on other folders when I define order between pages inside a given folder. Here is my use case to illustrate: When work in a directory, i start by odering my pages by increments of 10.
This way, when I need to insert a page later, I can do so without renumbering all pages.
Now, the problem is when I want to insert a page first in one folder. I will give it order 5, and by doing so, Starlight will not only insert my page first, but will also place this folder on top of my sidebar, which is not what I want. |
In addition, nested directories cannot have custom labels. My suggestion would be to have something simillar on how docusaurus do.
Those should allow you to manually fix the above. |
I am also highlight interested in both issues:
Is there already a solution for that? |
Nuxt Content has a very nice way of supporting custom ordering, by allowing numeric prefixes in the filename, which it then ignores when generating the slug/ID. |
To throw 2c in: I was looking at migrating a site to Astro, but my existing content all contains numeric prefixes I was surprised that Starlight doesn't have the ability to ignore those prefixes as @jits mentioned. |
What version of
starlight
are you using?0.14.0
What version of
astro
are you using?3.6.4
What package manager are you using?
pnpm
What operating system are you using?
Mac
What browser are you using?
Chrome
Describe the Bug
As discussed on Discord,
If I give my folder-1/page-1.md an order property of 10, and my folder-2/page-1.md an order property of 5, I end-up with my folder-2 being ranked above folder-1 in my sidebar.
Said differently, autogenerated folders are sorted according to the order of the first page in the directory.
In the stackblitz example linked below, in the fruits directory, the banana subdirectory comes before the apples subdirectory because it has a page with order 1, when apples has a page with order 5.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-dssfwv?file=src%2Fcontent%2Fdocs%2Ffruits%2Fbananas%2Flatundan.md
Participation
The text was updated successfully, but these errors were encountered: