Skip to content

Feature: Collection sort order in admin sidebar #474

@Emlembow

Description

@Emlembow

Problem

Collections in the admin sidebar are sorted alphabetically by slug (see `listCollections` in `packages/core/src/schema/registry.ts:85` — `.orderBy("slug", "asc")`). This forces arbitrary ordering that rarely matches how content should be presented on the site.

For example, a portfolio site with `positions`, `projects`, `education`, `certifications`, `endorsements`, `posts`, `pages` always shows them in alphabetical order in the admin: Certifications → Education → Endorsements → Pages → Positions → Posts → Projects — regardless of the logical order the site renders them in.

Proposed Solution

Add a `sort_order` column to `_emdash_collections` (nullable integer). Update `listCollections` to `.orderBy("sort_order", "asc")` with a secondary sort on `slug` for ties (and for collections with no explicit order).

Schema change

  • Migration: `ALTER TABLE _emdash_collections ADD COLUMN sort_order INTEGER`
  • Update `Collection` type and seed schema to accept `sortOrder` / `sort_order`
  • Expose reordering in the admin UI (drag-to-reorder, like fields/menus/widgets already have)

Seed file

```jsonc
{
"collections": [
{ "slug": "positions", "sortOrder": 1, ... },
{ "slug": "projects", "sortOrder": 2, ... }
]
}
```

Workarounds

None that don't involve renaming slugs (which breaks URLs and queries) or forking the admin.

Related

  • `packages/core/src/schema/registry.ts:85` — alphabetical sort
  • `packages/admin/src/components/Sidebar.tsx:169` — consumes the manifest collections as-is
  • `packages/admin/src/lib/api/schema.ts` already has `reorderFields`, `reorderMenuItems`, `reorderWidgets` — same pattern would apply for collections

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions