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

@ -1,16 +1,10 @@
import siteConfiguration from "../../../site.json";
/* ── Navigation (075_site_nav.sql) ───────────────────────────────
Pages → Navigation: the header's and footer's links, and each
static page's title, intro and whether it's hidden. Admins and up
save it, since hiding takes a page off the site. Server side:
Pages → Navigation: the header's and footer's links. The pages
themselves (titles, intros, Hidden, Disabled) are Page
management's (sitePages.ts). Admins and up. Server side:
server/src/admin-schema/siteNav.js; the site reads it through
server/src/siteNav.js and src/lib/useSiteNav.ts. */
const SITE_PAGES: [string, string][] = Object.entries(siteConfiguration.pages).map(
([path, page]) => [path, `${page.title} (${path})`],
);
const PLACES: [string, string][] = [
["main", "Header: pages"],
["action", "Header: buttons"],
@ -36,7 +30,7 @@ export const siteNav = {
{
key: "links",
label: "Links",
note: "Top to bottom, in the order each place shows them. A link to a hidden page is only shown to signed-in admin accounts. A header page lists its sections under it by itself (Pages → the page).",
note: "Top to bottom, in the order each place shows them. A link to a hidden page is only shown to signed-in admin accounts, and one to a disabled page to no one. A header page lists its sections under it by itself (Pages → the page).",
addLabel: "Add link",
title: (row) => (row.label ? `${row.label} · ${placeLabel(row.place) ?? "No place"}` : "New link"),
blank: { place: "", label: "", path: "", parent_path: "", style: "", new_tab: 0 },
@ -54,7 +48,7 @@ export const siteNav = {
path: "parent_path",
label: "Under page",
widget: "select",
options: [["/", "Home (/)"], ...SITE_PAGES],
optionsFrom: "site_pages",
blankLabel: "Default: its own place in the header",
help: "Lists it in that page's menu, after its sections, instead of in the header's row",
when: { path: "place", value: "main" },
@ -70,35 +64,5 @@ export const siteNav = {
{ path: "new_tab", label: "Opens in a new tab", widget: "checkbox" },
],
},
{
key: "pages",
label: "Pages",
note: "A page's heading and intro (also its search title and description), and whether it's hidden. A hidden page is out of the menus and the sitemap and says Not found to everyone but signed-in admin accounts, who see it with a bar saying it's hidden. Blank fields keep site.json's. A page not listed here shows as site.json has it.",
addLabel: "Add page",
title: (row) =>
`${SITE_PAGES.find(([path]) => path === row.path)?.[1] ?? "New page"}${row.is_hidden ? " · Hidden" : ""}`,
blank: { path: "", title: "", description: "", is_hidden: 0 },
fields: [
{ path: "path", label: "Page", widget: "select", options: SITE_PAGES, required: true },
{
path: "is_hidden",
label: "Hidden",
widget: "checkbox",
help: "Not found to everyone but signed-in admin accounts, eg. a page that isn't done",
},
{
path: "title",
label: "Title",
help: (row) => (row?.path ? `Default: ${siteConfiguration.pages[row.path]?.title ?? ""}` : undefined),
},
{
path: "description",
label: "Intro",
widget: "textarea",
full: true,
help: (row) => (row?.path ? `Default: ${siteConfiguration.pages[row.path]?.description ?? ""}` : undefined),
},
],
},
],
};