Repository navigation
Description
Problem
CollectionRepository.list() (in registry-Ci3WxVAr.mjs:361) hardcodes .orderBy("slug", "asc") when fetching collections. This propagates to the manifest and into the admin sidebar, so editors see collections sorted alphabetically by slug — which usually doesn't match how often a collection is edited or where it sits in editorial priority.
We just rolled out a deployment with 9 collections (pages, posts, case_studies, resources, solutions, team_members, webinars, plus two custom ones — legal and landing_pages). The marketing team's mental priority order is:
- Pages (most-edited)
- Solutions
- Case Studies
- Resources
- Landing Pages
- Blog Posts
- Webinars
- Team Members
- Legal (least-edited reference content)
But the sidebar shows them as: Case Studies, Landing Pages, Legal, Pages, Posts, Resources, Solutions, Team Members, Webinars. "Legal" floats to position 3 because it starts with "L", which is the opposite of what we want.
There's currently no way to override this without renaming slugs to prefix-encode the order (01_pages, 02_solutions, …) — which breaks every getEmDashEntry() call site and ripples through generated types.
Proposal
Add a nullable sort_order INTEGER column to _emdash_collections, mirroring the same field that already exists on _emdash_fields:
.orderBy("sort_order", "asc")
.orderBy("slug", "asc") // tiebreakerBehaviour:
sort_order = NULL→ fall back to alphabetical (preserves current behaviour for existing deployments)sort_order = <integer>→ places the collection at that position- Seed file gains an optional
sortOrderfield on each collection block, mirroringfields[].sortOrder - Admin UI: when this lands, an obvious follow-up is a drag-to-reorder affordance in
/admin/settings/content-types, but the field on its own is enough to unblock people via seed/CLI
Why not just rename slugs
Tried it; bad path. The slug is used:
- As the foreign key in
_emdash_fields.collection_id-shaped joins - As the URL discriminator in
[collection]/[id]admin routes - As the API key in
getEmDashEntry(collection, slug)call sites in user code - As the type key in generated
emdash-env.d.ts
A prefix rename touches everything. A sort_order column touches nothing user-visible except the sidebar order.
Prior art
The _emdash_fields table already has sort_order INTEGER and CollectionRepository.listFields() already uses .orderBy("sort_order", "asc").orderBy("created_at", "asc"). This proposal extends the same pattern up one level.
Happy to PR this
Small, self-contained change. Migration adds the column, the seeder writes it, the repository method picks it up. If you'd rather have it land that way let me know — otherwise an upvote thumb on this issue is fine and we'll wait for whoever lands it.
Activity
ascorbic commentedon Apr 29, 2026
Closing as a duplicate of #474, which tracks the same request (collection sort order in admin sidebar). #474 has earlier discussion -- please follow that one for updates and feel free to add any details from your spec proposal there.