Skip to content

Collection list: allow a default sort, and control over the Slug column #1579

Description

@renatomprado

Two small gaps in the collection list view (packages/keystatic/src/app/CollectionPage.tsx). They're separate asks but they live in the same component, so I'm filing them together.

1. Default sort is fixed to slug ascending

let [sortDescriptor, setSortDescriptor] = useState({
  column: SLUG,
  direction: 'ascending',
});

For a blog, alphabetical-by-filename is close to random order, and the useful default is newest first. You can click the date column header, but it resets on every reload, so the editor re-sorts constantly.

parseSlugForSort exists, but it changes how the slug column sorts rather than which column is used, so it only helps when the date is part of the filename — which it isn't when the slug is the URL.

Proposal: an optional defaultSort on the collection:

defaultSort?: { column: string; direction: 'ascending' | 'descending' }

falling back to today's behaviour when absent.

2. The Slug column is always second and can't be hidden

return [
  ...(hideStatusColumn ? [] : [statusColumn]),
  { name: 'Slug', key: SLUG },
  ...collection.columns.map(...),
];

columns controls the configured columns and their order, but Slug is fixed ahead of them.

This matters most when slugField points at the title, which I'd guess is the common setup. Then the list shows the same text twice — once in kebab-case as Slug and once as the Title column — and the duplicate takes the more prominent position. My client's list reads:

Slug Data de publicação Título
dores-no-climaterio 2026-08-05 Dores no climatério: o que muda no corpo depois dos 40

The slug is developer information. She doesn't need it, and it's the second thing she sees.

Proposal: either let columns include the slug explicitly (so its position is up to the config), or add something like showSlugColumn?: boolean. The first is more flexible; the second is a smaller change and probably enough.

Context

Two Keystatic Cloud panels used by non-technical clients in Brazil. Related to #1578, but independent — that one is about strings, this is about the list view. Happy to send a PR for either or both if you're open to the shape.

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