Page management, step 1: every page in a registry, new pages, hidden and disabled

Migration 080 makes site_pages the list of every page: address, title,
intro, Hidden, Disabled (out of menus, sitemap and search) and card order.
site.json's pages and Navigation's page list move into it. Pages ->
Page management (one editor in place of six) makes new pages of sections
at any free address; the admin home opens Pages with a banner and a card
per page. A catch-all route draws whatever page is at an address; the
fixed pages take their words from the registry and can't be deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aidan Dona 2026-10-16 23:19:54 -05:00
parent 56acedf926
commit 1342691f49
36 changed files with 584 additions and 405 deletions

View file

@ -2,7 +2,7 @@
NOT FOUND: any address no route matches
Rather than a dead end, the closest pages to the address that
failed: the static pages (site.json's) and every public, listed
failed: the site's pages (Page management's) and every public, listed
record (GET /directory), scored by suggest.ts against the
address. So /organisation offers Organization, /retreat offers
Retreats, and an old /chapters/lynnwood offers the Lynnwood group.
@ -18,8 +18,7 @@ import { useMemo } from 'react'
import { Link, useLocation } from 'react-router-dom'
import PageShell from '../components/PageShell.tsx'
import { useSiteNav } from '../lib/useSiteNav.ts'
import { SITE_PAGES } from '../lib/site.ts'
import { useSiteNav, type SitePageInfo } from '../lib/useSiteNav.ts'
import { useDirectory, type Directory } from '../lib/useContent.ts'
import { blogHref, eventHref, orgHref, personHref, teamHref, awardHref } from '../lib/hrefs.ts'
import { suggest, type Candidate } from '../lib/suggest.ts'
@ -36,12 +35,12 @@ const ORG_KIND_LABEL: Record<string, string> = {
/* Everything an address could have meant: the static pages (not the
hidden ones), then each kind of record, with the words to match
it by. */
function candidates(directory: Directory | null, isHidden: (path: string) => boolean): Candidate[] {
const pages: Candidate[] = Object.entries(SITE_PAGES).filter(([path]) => !isHidden(path)).map(([path, page]) => ({
href: path,
function candidates(directory: Directory | null, sitePages: SitePageInfo[]): Candidate[] {
const pages: Candidate[] = sitePages.filter((page) => !page.hidden && page.path !== '/').map((page) => ({
href: page.path,
label: page.title,
detail: 'Page',
keys: [path.slice(1), page.title],
keys: [page.path.slice(1), page.title],
}))
if (!directory) return pages
@ -66,10 +65,10 @@ function candidates(directory: Directory | null, isHidden: (path: string) => boo
export default function NotFound() {
const { pathname } = useLocation()
const { data: directory, loading } = useDirectory()
const { main: pages, isHidden } = useSiteNav()
const { main: pages, pages: sitePages } = useSiteNav()
const matches = useMemo(
() => suggest(pathname, candidates(directory ?? null, isHidden)),
[pathname, directory, isHidden],
() => suggest(pathname, candidates(directory ?? null, sitePages)),
[pathname, directory, sitePages],
)
const reading = useReadingMode()