Skip to content

feat: edit taxonomy terms in the page editor - #34

Merged
zumbrunn merged 3 commits into
mainfrom
feat/page-editor-taxonomy-31
Nov 12, 2026
Merged

zumbrunn merged 3 commits into
mainfrom
feat/page-editor-taxonomy-31

Conversation

@zumbrunn

@zumbrunn zumbrunn commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Closes #31.

The page editor sidebar gets one control per site taxonomy (site.taxonomies): terms as removable chips, an input to add (Enter, comma, or leaving the field) with the site's existing terms as datalist suggestions. Writes taxonomy.<name> as a list of terms. Core keys terms by the raw string, case-sensitively, so terms are not slugs: what you type is matched case-insensitively against the page's terms (no-op) and the site's existing terms (reuses that spelling), otherwise kept as typed. Pasting "a, b" adds two terms.

  • Works without a blueprint; a blueprint declaring its own taxonomy field wins and the built-in control is hidden.
  • Anything it does not understand (bare string, object, non-string items, taxonomy not an object) is shown as not editable and left untouched; other taxonomies' values are preserved when one is edited.
  • An emptied taxonomy is removed; an empty taxonomy object is dropped (null → the PUT handler deletes the key).
  • taxonomy no longer counts as an unmanaged key while the control is shown.
  • GET /admin/api/pages/:path returns taxonomies (name → terms in use, most used first, capped at 500 per taxonomy).

Tests cover the pure helpers (list/absent/non-list values, preserving others, empty handling, dedupe, case-insensitive matching) and the unmanaged-keys rule. deno test passes (316).

Browser check (local site, this branch, built-in browser):

  • Type a term, then click Save without Enter: this failed at first. The blur made the "Unsaved" badge appear, the toolbar re-wrapped, and Save moved out from under the click, so nothing was saved. Fixed: the badge is always laid out (hidden when clean), and save() reads the latest frontmatter from a ref. After the fix the term is in the file after Save.
  • Enter and comma add a term; "qux,BAR, Zed" gave qux and Zed, and BAR was dropped because bar is already there. Removing a chip and saving rewrote the list correctly.
  • A page with taxonomy: { tag: solo } shows "not a plain list", and Save left tag: solo untouched.
  • Not checked: touch/mobile input, and the datalist suggestion popup.

Also fixed: the GET /admin/api/pages test context had no config.site, which made two existing tests fail on this branch.

Note: the CHANGELOG Unreleased section will conflict trivially with #32/#33; resolve by keeping all entries.

🤖 Generated with Claude Code

zumbrunn and others added 3 commits November 12, 2026 11:16
Closes #31

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… right after typing a term

addTerm matches existing terms case-insensitively (core keys terms by the
raw string) and reuses the spelling already used on the site. A pasted
'a, b' becomes two terms. The Unsaved badge is always laid out so the
blur that dirties the page no longer moves Save out from under the click,
and save() reads the latest frontmatter from a ref.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… term matching and Save fix

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@zumbrunn
zumbrunn force-pushed the feat/page-editor-taxonomy-31 branch from 4af02cf to c559f5d Compare November 12, 2026 10:16
@zumbrunn
zumbrunn merged commit 68afa3c into main Nov 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Page editor has no control for taxonomy terms (tags)

1 participant