Thinkmill / Thinkmill/keystatic

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

Open
#1,579 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.4k
Forks
159
Avg merge
21h 41m
Merged PRs (30d)
2

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/keystatic/src/app/CollectionPage.tsx, tracing the sortDescriptor initialization and the array that builds the collection columns, then find the collection configuration type that supplies these options. Done means a collection can configure its default sort and either position or hide the Slug column, while existing behavior remains unchanged when no option is provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.