Cleanup of old-data fixes; an editor for the Organization page

Nothing before these changes was ever public, so the fixes kept for
older data go: the /leadership redirect (MOVED in routes/pages.js),
index.html's move of "ngu-" browser keys to "site-", the boot-time
sorting of images from before folders (media.js), and emoji path
icons (a path with no named icon shows a dot; migration 055 turns
the baseline's seeded emoji into their names).

Pages → Organization page (migration 055): a singleton with the
Mission, Vision & Values blocks, the Leadership blocks (a People
block per team, in order) with a heading and blurb, and Volunteering
(title, blurb, links). content_blocks gains the two owner kinds;
GET /organization-page serves it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-30 23:37:35 -05:00
parent 1da79c128b
commit 43797f38bc
14 changed files with 308 additions and 127 deletions

View file

@ -0,0 +1,43 @@
/* ═══════════════════════════════════════════════════════════════
ORGANIZATION PAGE ROUTE: read-only, mounted under /api
GET /organization-page the Organization page's own content:
its section titles, the Mission and
Leadership blocks, and Volunteering
(title, blurb, links)
Edited in the admin as Pages → Organization page
(admin-schema/organizationPage.js). The blocks are shaped as on
any record page (loadBlocks), so ContentBlocks draws them.
═══════════════════════════════════════════════════════════════ */
import { Hono } from "hono";
import { json, loadBlocks } from "../shape.js";
const ID = "organization";
const organizationPage = new Hono();
organizationPage.get("/organization-page", (c) => {
const db = c.get("db");
const row = db.prepare(`SELECT * FROM organization_page WHERE id = ?`).get(ID) ?? {};
const links = db
.prepare(`SELECT label, url FROM organization_page_links WHERE page_id = ? ORDER BY sort_order, id`)
.all(ID);
return json(c, {
page: {
mission_title: row.mission_title ?? null,
mission_blocks: loadBlocks(db, "org_page_mission", [ID]).get(ID) ?? [],
leadership_title: row.leadership_title ?? null,
leadership_blurb: row.leadership_blurb ?? null,
leadership_blocks: loadBlocks(db, "org_page_leadership", [ID]).get(ID) ?? [],
volunteer: {
title: row.volunteer_title ?? null,
blurb: row.volunteer_blurb ?? null,
links,
},
},
});
});
export default organizationPage;

View file

@ -21,9 +21,6 @@
the app's own not-found page with a 404 status, so search engines
drop it.
A page that moved answers with a 301 to where it is now (MOVED),
so old links, QR codes and search results keep working.
If the metadata can't be built (no site.json at SITE_CONFIG, say),
the page is still served, as built, and the cause is logged once:
a preview is never worth a page that won't load.
@ -92,23 +89,12 @@ pages.get("/sitemap.xml", (c) => {
});
});
/* Pages that have moved: old path → new, query string kept. */
const MOVED = {
"/leadership": "/organization",
};
pages.get("*", (c, next) => {
const pathname = c.req.path;
// The API's own paths, and an upload that isn't there, stay plain
// 404s rather than becoming a page.
if (/^\/(api|uploads)(\/|$)/.test(pathname)) return next();
const moved = MOVED[pathname.replace(/(.)\/+$/, "$1")];
if (moved) {
const query = new URL(c.req.url).search;
return c.redirect(moved + query, 301);
}
let html;
try {
html = indexHtml();