diff --git a/CLAUDE.md b/CLAUDE.md
index 375dde6..f9737d3 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -32,7 +32,7 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu
- Debugging: check `journalctl -u ngu-api -n 40 --no-pager` first. Make sure rsync ran from the repo (not the deployed copy) before restarting the service.
- Never run commands against the production server or database unless explicitly asked.
- Uploaded media: `UPLOADS_DIR=/var/lib/ngu/uploads`, served by nginx at `/uploads/`. Setup and the nginx block are in `docs/media-uploads.md`.
-- Page HTML goes through the API, which fills in each page's title, description, preview image and structured data (`server/src/pageMeta.js`), and serves `/sitemap.xml`. It reads `SITE_CONFIG` (site.json) and `SITE_INDEX` (the built index.html). nginx setup: `docs/seo.md`.
+- Page HTML goes through the API, which fills in each page's title, description, preview image and structured data (`server/src/pageMeta.js`), and serves `/sitemap.xml`. It reads `SITE_CONFIG` (site.json) and `SITE_INDEX` (the built index.html), with Panel → Site settings (the `site_settings` table) laid over site.json, and serves `/robots.txt` from the same merge. nginx setup: `docs/seo.md`.
- Google sign-in for @nextgenerationofunity.org admin accounts: on when `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` are set on the service. Only existing accounts (made by admin-cli) get in; passwords still work. Setup: `docs/google-sign-in.md`.
## Git workflow
diff --git a/docs/seo.md b/docs/seo.md
index 40b83e6..feaa726 100644
--- a/docs/seo.md
+++ b/docs/seo.md
@@ -11,6 +11,14 @@ in `server/src/pageMeta.js`). It also serves `/sitemap.xml`.
## Where the words come from
+Everything below can also be set in the admin, under **Panel → Site
+settings** (superadmins only): the site's name, description, preview
+image, favicon and home-screen icon, each static page's title and intro,
+and whether search engines may list the site. A setting there wins; a
+blank one falls back to `site.json`. The indexing switch is per
+database, so the dev server can be off while production is on, from the
+same build.
+
| What | Where |
| --- | --- |
| Site name, address, default description | `site.json`: `title`, `url`, `description` (blank uses the front page's subhead) |
@@ -83,6 +91,18 @@ with it off it blocks everything.
try_files /index.html =404;
}
+ # From the API, so Site settings' indexing switch applies; the
+ # build's own robots.txt if the API is down.
+ location = /robots.txt {
+ proxy_pass http://127.0.0.1:3001;
+ proxy_intercept_errors on;
+ error_page 500 502 503 504 = @file;
+ }
+
+ location @file {
+ try_files $uri =404;
+ }
+
# Uploads are bigger than the /api/ block's 64k limit allows.
location = /api/admin/media {
proxy_pass http://127.0.0.1:3001;
diff --git a/docs/updating-data-in-code.md b/docs/updating-data-in-code.md
index b4cc268..bd861f7 100644
--- a/docs/updating-data-in-code.md
+++ b/docs/updating-data-in-code.md
@@ -33,7 +33,7 @@ what a dropdown in the admin editor says.
| The **label** a dropdown shows in the admin | code | [one file](#renaming-what-a-dropdown-shows) |
| The **list of allowed values** behind a fixed dropdown | database CHECK + code | [a migration and three files](#adding-removing-or-renaming-a-stored-value) |
| Navigation, page section titles, colours, the site banner, history decades, the map grid | code | [the file named below](#other-content-that-lives-in-code) |
-| A static page's title and intro (also its search title and description), the site's name, address and default preview image | `site.json` | editing `pages`, `title`, `url`, `openGraph.image`. See `docs/seo.md` |
+| A static page's title and intro (also its search title and description), the site's name, description, preview image, icons, search indexing | the database, over `site.json` | Admin → Panel → Site settings (superadmins). Blank uses `site.json`, which also holds the site's address and the pages' defaults. See `docs/seo.md` |
| Uploaded images | disk + the `media` table | Admin → Tools → Media, or any image field. See `docs/media-uploads.md` |
The rule of thumb from `CLAUDE.md`: data belongs in the database,
diff --git a/server/src/admin-schema.js b/server/src/admin-schema.js
index edc53a8..9e85beb 100644
--- a/server/src/admin-schema.js
+++ b/server/src/admin-schema.js
@@ -904,6 +904,47 @@ const communityPage = {
],
};
+/* ── Site settings (035_site_settings.sql) ──────────────────────
+ A singleton of overrides for what site.json says: name,
+ description, preview image, icons, search indexing, and static
+ pages' titles and intros. Superadmins only. pageMeta.js merges it
+ over site.json. */
+const siteSettings = {
+ key: "site_settings",
+ table: "site_settings",
+ idColumn: "id",
+ idKind: "slug",
+ singleton: "site",
+ concurrency: "updated_at",
+ writeRole: "superadmin",
+
+ list: {
+ columns: ["id", "site_name", "updated_at"],
+ filters: [],
+ search: [],
+ order: "id",
+ },
+
+ columns: [
+ text("site_name"),
+ text("description"),
+ text("preview_image"),
+ text("favicon"),
+ text("apple_touch_icon"),
+ enumeration("indexing", ["on", "off"]),
+ ],
+
+ children: [
+ {
+ key: "pages",
+ table: "site_setting_pages",
+ owner: { column: "settings_id" },
+ order: "sort_order",
+ columns: [text("path", { required: true }), text("title"), text("description")],
+ },
+ ],
+};
+
export const ENTITIES = {
organizations,
events,
@@ -914,6 +955,7 @@ export const ENTITIES = {
front_page: frontPage,
blog_posts: blogPosts,
community_page: communityPage,
+ site_settings: siteSettings,
};
/* ── Options for the form's select inputs ────────────────────── */
diff --git a/server/src/auth.js b/server/src/auth.js
index d1eed5a..ca7d977 100644
--- a/server/src/auth.js
+++ b/server/src/auth.js
@@ -201,6 +201,11 @@ export async function requireAuth(c, next) {
export const ROLES = ["viewer", "editor", "admin", "superadmin"];
const RANK = { viewer: 1, editor: 2, admin: 3, superadmin: 4 };
+/* Whether a user is at least this rank. A ladder, never equality. */
+export function hasRole(user, role) {
+ return (RANK[user?.role] ?? 0) >= (RANK[role] ?? Infinity);
+}
+
export function requireRole(...roles) {
const need = Math.min(...roles.map((r) => RANK[r] ?? Infinity));
return async (c, next) => {
diff --git a/server/src/migrations/035_site_settings.sql b/server/src/migrations/035_site_settings.sql
new file mode 100644
index 0000000..e2a38c0
--- /dev/null
+++ b/server/src/migrations/035_site_settings.sql
@@ -0,0 +1,62 @@
+-- ═══════════════════════════════════════════════════════════════
+-- 035 SITE SETTINGS
+--
+-- What the site says about itself, editable in the admin (Panel →
+-- Site settings, superadmins only) instead of only in site.json.
+-- Every column is an override: null means "whatever site.json
+-- says", so a fresh database behaves exactly as before and the
+-- built index.html (made from site.json) stays a true fallback for
+-- when the API is down.
+--
+-- site_name the site's name, in every title
+-- description the default search description
+-- preview_image the default link-preview image
+-- favicon the browser-tab icon ('/uploads/…', PNG or SVG)
+-- apple_touch_icon the home-screen icon on iPhones (PNG, 180px)
+-- indexing 'on' or 'off': whether search engines may list
+-- the site. Per database, so the dev server can
+-- say off while production says on, from one
+-- build. Null follows site.json's robots.index.
+--
+-- site_setting_pages overrides a static page's title and intro
+-- (site.json's "pages"), one row per page that differs. The path
+-- must be one of site.json's pages; the admin only offers those.
+--
+-- A singleton like front_page: one row, made here, which the admin
+-- edits and can't delete.
+--
+-- PRAGMA user_version; -- reads 34 before this file
+-- ═══════════════════════════════════════════════════════════════
+
+CREATE TABLE site_settings (
+ id TEXT PRIMARY KEY CHECK (id = 'site'),
+ site_name TEXT,
+ description TEXT,
+ preview_image TEXT,
+ favicon TEXT,
+ apple_touch_icon TEXT,
+ indexing TEXT CHECK (indexing IN ('on', 'off')),
+ updated_at TEXT NOT NULL DEFAULT (datetime('now'))
+) STRICT;
+
+INSERT INTO site_settings (id) VALUES ('site');
+
+CREATE TABLE site_setting_pages (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ settings_id TEXT NOT NULL REFERENCES site_settings (id) ON DELETE CASCADE,
+ sort_order INTEGER NOT NULL DEFAULT 0,
+ path TEXT NOT NULL, -- '/retreats'
+ title TEXT,
+ description TEXT,
+ UNIQUE (settings_id, path)
+) STRICT;
+
+
+-- ── Triggers last (see CLAUDE.md, Migrations) ──
+
+CREATE TRIGGER site_settings_touch
+AFTER UPDATE ON site_settings
+FOR EACH ROW WHEN new.updated_at = old.updated_at
+BEGIN
+ UPDATE site_settings SET updated_at = datetime('now') WHERE id = new.id;
+END;
diff --git a/server/src/pageMeta.js b/server/src/pageMeta.js
index c76dc45..ae7bd08 100644
--- a/server/src/pageMeta.js
+++ b/server/src/pageMeta.js
@@ -13,9 +13,13 @@
── Where it comes from ──
/site.json (SITE_CONFIG): the site's name, address, default
- description and image, and each static page's title and
- description. The pages read the same file for their heading and
- intro, so the two can't drift.
+ description and image, icons, and each static page's title and
+ description. Laid over it: Panel → Site settings (the
+ site_settings table, 035), where anything set wins and anything
+ blank falls back to site.json. siteFor(db) does the merge. The
+ pages read the same merged values (renderPage writes them into
+ the HTML as window.__NGU_SITE__, see src/lib/site.ts), so a
+ heading and its search title can't drift.
The database: records' names, taglines, first paragraphs and
images. A blank site description falls back to the front page's
subhead.
@@ -63,6 +67,57 @@ export function loadSite() {
const origin = (site) => (site.url ?? "").replace(/\/$/, "");
+/* site.json with the admin's Site settings laid over it: a value set
+ there wins, a blank one falls back. indexing 'on' / 'off' overrides
+ robots.index for this database only. Page overrides apply only to
+ pages site.json knows. */
+export function siteFor(db) {
+ const base = loadSite();
+ const row = db.prepare(`SELECT * FROM site_settings WHERE id = 'site'`).get() ?? {};
+
+ const pages = { ...(base.pages ?? {}) };
+ const overrides = db
+ .prepare(`SELECT path, title, description FROM site_setting_pages WHERE settings_id = 'site'`)
+ .all();
+ for (const page of overrides) {
+ const known = pages[page.path];
+ if (!known) continue;
+ pages[page.path] = {
+ title: page.title || known.title,
+ description: page.description || known.description,
+ };
+ }
+
+ return {
+ ...base,
+ title: row.site_name || base.title,
+ description: row.description || base.description,
+ openGraph: { ...base.openGraph, image: row.preview_image || base.openGraph?.image },
+ icons: {
+ ...base.icons,
+ icon: row.favicon || base.icons?.icon,
+ apple: row.apple_touch_icon || base.icons?.apple,
+ },
+ robots: {
+ ...base.robots,
+ index: row.indexing ? row.indexing === "on" : base.robots?.index !== false,
+ },
+ pages,
+ };
+}
+
+/* What the browser app reads for headings and titles. */
+const forBrowser = (site) => ({ title: site.title, pages: site.pages });
+
+/* robots.txt for this database's setting, as the build writes it. */
+export function robotsTxt(site) {
+ if (site.robots?.index === false) return "User-agent: *\nDisallow: /\n";
+ return (
+ "User-agent: *\nDisallow: /admin\nDisallow: /api\n" +
+ (site.url ? `\nSitemap: ${origin(site)}/sitemap.xml\n` : "")
+ );
+}
+
/* ── Helpers ───────────────────────────────────────────────── */
/* Text as a description: the formatting marks content blocks allow
@@ -112,6 +167,7 @@ function defaults(site, db, pathname) {
type: "website",
noindex: false,
jsonLd: null,
+ site,
};
}
@@ -277,7 +333,7 @@ function blogMeta(site, db, id, meta) {
/* The metadata for one request path. */
export function metaFor(db, rawPath) {
- const site = loadSite();
+ const site = siteFor(db);
// Canonical form: no trailing slash (but "/" itself), no query.
const pathname = rawPath.split(/[?#]/)[0].replace(/(.)\/+$/, "$1") || "/";
const meta = defaults(site, db, pathname);
@@ -352,10 +408,15 @@ const REPLACED = [
/]*>\s*/gi,
/]*>\s*/gi,
/`,
+ site.icons?.icon && ``,
+ site.icons?.apple && ``,
+ meta.jsonLd && ``,
+ // Read by src/lib/site.ts before the app's module runs (a plain
+ // script in the head runs during parsing; modules wait).
+ ``,
].filter(Boolean);
- // A blocked site (site.json robots.index false) stays blocked on
- // every page, whatever the record says.
+ // A blocked site (Site settings indexing off, or site.json's
+ // robots.index false) stays blocked on every page, whatever the
+ // record says.
if (site.robots?.index === false && !meta.noindex) {
tags.splice(2, 0, ``);
}
@@ -390,7 +456,7 @@ export function renderPage(html, meta) {
/* ── Sitemap ───────────────────────────────────────────────── */
export function sitemap(db) {
- const site = loadSite();
+ const site = siteFor(db);
const base = origin(site);
const day = (value) => (value ? String(value).slice(0, 10) : null);
diff --git a/server/src/routes/admin-entities.js b/server/src/routes/admin-entities.js
index 9b700aa..f50c64b 100644
--- a/server/src/routes/admin-entities.js
+++ b/server/src/routes/admin-entities.js
@@ -18,7 +18,7 @@
import { Hono } from "hono";
-import { requireAuth, requireRole } from "../auth.js";
+import { hasRole, requireAuth, requireRole } from "../auth.js";
import { ENTITIES, OPTION_QUERIES } from "../admin-schema.js";
import {
HttpError,
@@ -41,6 +41,17 @@ function entityOr404(c) {
return entity;
}
+/* Saving needs editor, unless the descriptor asks for more
+ (writeRole): site settings are superadmin-only. requireRole on the
+ route is the floor; this is the entity's own bar on top. */
+function entityForWrite(c) {
+ const entity = entityOr404(c);
+ if (entity.writeRole && !hasRole(c.get("user"), entity.writeRole)) {
+ throw new HttpError(403, "Not allowed.");
+ }
+ return entity;
+}
+
/* Everything the select inputs need, in one request. Small enough
that paging it would cost more than it saves. */
entities.get("/options", (c) => {
@@ -64,14 +75,14 @@ entities.get("/:entity/:id", (c) => {
});
entities.post("/:entity", requireRole("editor"), async (c) => {
- const entity = entityOr404(c);
+ const entity = entityForWrite(c);
const row = createRow(c.get("db"), entity, await json(c));
console.log(`${entity.key} ${row[entity.idColumn]} created by ${c.get("user").email}`);
return c.json({ row }, 201, NO_STORE);
});
entities.patch("/:entity/:id", requireRole("editor"), async (c) => {
- const entity = entityOr404(c);
+ const entity = entityForWrite(c);
const id = c.req.param("id");
const row = updateRow(c.get("db"), entity, id, await json(c));
console.log(`${entity.key} ${id} updated by ${c.get("user").email}`);
diff --git a/server/src/routes/pages.js b/server/src/routes/pages.js
index 7c8905c..11a9323 100644
--- a/server/src/routes/pages.js
+++ b/server/src/routes/pages.js
@@ -2,6 +2,9 @@
PAGE ROUTES: the site's HTML, with each page's metadata
GET /sitemap.xml every public, listed page
+ GET /robots.txt this database's indexing setting (Site
+ settings, else site.json), so a dev server
+ can say no while production says yes
GET /anything the built index.html, its title, description,
preview image, canonical link and structured
data filled in for that path (pageMeta.js)
@@ -32,7 +35,7 @@ import { fileURLToPath } from "node:url";
import { Hono } from "hono";
-import { metaFor, renderPage, sitemap } from "../pageMeta.js";
+import { metaFor, renderPage, robotsTxt, siteFor, sitemap } from "../pageMeta.js";
const here = path.dirname(fileURLToPath(import.meta.url));
@@ -62,6 +65,17 @@ function warnOnce(key, message) {
console.error(message);
}
+pages.get("/robots.txt", (c) => {
+ let text;
+ try {
+ text = robotsTxt(siteFor(c.get("db")));
+ } catch (err) {
+ warnOnce(`robots:${err.message}`, `pages: can't build robots.txt: ${err.message}`);
+ return c.text("robots.txt isn't available.", 503);
+ }
+ return c.text(text, 200, { "Cache-Control": CACHE });
+});
+
pages.get("/sitemap.xml", (c) => {
let xml;
try {
diff --git a/src/lib/adminSchema.ts b/src/lib/adminSchema.ts
index 224dbd9..47dd041 100644
--- a/src/lib/adminSchema.ts
+++ b/src/lib/adminSchema.ts
@@ -18,6 +18,7 @@
import { preview } from "./text.ts";
import { PLATFORMS } from "./platforms.ts";
import { FORMATTING_HELP } from "../components/InlineText.tsx";
+import siteConfiguration from "../../site.json";
import {
awardLogo,
blockMedia,
@@ -1619,6 +1620,112 @@ const communityPage = {
],
};
+/* ── Site settings (035_site_settings.sql) ───────────────────────
+ Overrides for site.json, superadmins only: every blank falls back
+ to what site.json says, which is shown as the default. */
+const SITE_PAGES: [string, string][] = Object.entries(siteConfiguration.pages).map(
+ ([path, page]) => [path, `${page.title} (${path})`],
+);
+
+const siteSettings = {
+ key: "site_settings",
+ label: "Site settings",
+ singular: "site settings",
+ idLabel: "Settings",
+ singleton: "site",
+ writeRole: "superadmin",
+
+ list: { columns: [], filters: [] },
+
+ groups: [
+ {
+ legend: "The site",
+ note: "Anything left blank uses site.json, so the build and these settings agree until you change one.",
+ fields: [
+ { path: "site_name", label: "Site name", help: `Default: ${siteConfiguration.title}` },
+ {
+ path: "description",
+ label: "Description",
+ widget: "textarea",
+ full: true,
+ help: "Search engines and link previews show this for pages without their own. Default: site.json's, or the front page's subhead.",
+ },
+ {
+ path: "preview_image",
+ label: "Preview image",
+ widget: "image",
+ resolve: blogImage,
+ full: true,
+ help: "Shown when a page without its own image is shared. 1200 × 630 works everywhere.",
+ },
+ ],
+ },
+ {
+ legend: "Icons",
+ fields: [
+ {
+ path: "favicon",
+ label: "Favicon",
+ widget: "image",
+ resolve: blogImage,
+ full: true,
+ help: "The browser-tab icon: a square PNG (512px) or an SVG. Keep original when uploading an SVG.",
+ },
+ {
+ path: "apple_touch_icon",
+ label: "Home-screen icon",
+ widget: "image",
+ resolve: blogImage,
+ full: true,
+ help: "For iPhones saving the site to their home screen: a square PNG, 180px, no transparency.",
+ },
+ ],
+ },
+ {
+ legend: "Search engines",
+ fields: [
+ {
+ path: "indexing",
+ label: "Let search engines list this site",
+ widget: "select",
+ options: [
+ ["on", "On: pages can appear in Google"],
+ ["off", "Off: hidden from search (use on the dev server)"],
+ ],
+ blankLabel: `Default: site.json (${siteConfiguration.robots?.index === false ? "off" : "on"})`,
+ help: "Applies to this server's database only, so dev can be off while production is on.",
+ },
+ ],
+ },
+ ],
+
+ children: [
+ {
+ key: "pages",
+ label: "Page titles and intros",
+ note: "Change a static page's heading and intro, which are also its search title and description. Blank fields keep site.json's.",
+ addLabel: "Change a page",
+ title: (row) => SITE_PAGES.find(([path]) => path === row.path)?.[1] ?? "New page",
+ blank: { path: "", title: "", description: "" },
+ fields: [
+ { path: "path", label: "Page", widget: "select", options: SITE_PAGES, required: true },
+ {
+ 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),
+ },
+ ],
+ },
+ ],
+};
+
export const ADMIN_ENTITIES: Record = {
organizations,
events,
@@ -1629,6 +1736,7 @@ export const ADMIN_ENTITIES: Record = {
front_page: frontPage,
blog_posts: blogPosts,
community_page: communityPage,
+ site_settings: siteSettings,
};
export function slugify(value) {
diff --git a/src/lib/site.ts b/src/lib/site.ts
index 43b8cab..7bd2644 100644
--- a/src/lib/site.ts
+++ b/src/lib/site.ts
@@ -1,10 +1,17 @@
/* ═══════════════════════════════════════════════════════════════
SITE
- What /site.json says about the site, for the browser. The server
- reads the same file for the metadata it puts in each page's HTML
- (server/src/pageMeta.js), so a page's visible heading and intro
- and its search title and description come from one place.
+ What the site says about itself, for the browser: /site.json, with
+ the admin's Site settings (Panel) laid over it. The server merges
+ the two and writes the result into each page's HTML as
+ window.__NGU_SITE__ (server/src/pageMeta.js), which is read here
+ before the app renders, so there's no request and no flash of the
+ old wording. In development, or if the API is down and nginx
+ serves the plain index.html, it isn't there and site.json alone
+ applies.
+
+ A page's visible heading and intro and its search title and
+ description come from the same values, so they can't drift.
SITE_ORIGIN is the public address of the live site. It's used
where a URL has to leave the browser and still work: a printed QR
@@ -15,16 +22,25 @@
import siteConfiguration from '../../site.json'
-export const SITE_NAME: string = siteConfiguration.title
+type PageText = { title: string; description: string }
+
+type SiteText = { title?: string; pages?: Record }
+
+/* What the server wrote into the page, if it did. */
+const fromServer: SiteText =
+ (typeof window !== 'undefined' && (window as unknown as { __NGU_SITE__?: SiteText }).__NGU_SITE__) || {}
+
+export const SITE_NAME: string = fromServer.title || siteConfiguration.title
export const SITE_ORIGIN: string = siteConfiguration.url
/** A site path as a full URL on the live site. */
export const siteUrl = (path: string): string => new URL(path, SITE_ORIGIN).href
-type PageText = { title: string; description: string }
+const PAGES: Record = { ...siteConfiguration.pages, ...fromServer.pages }
-const PAGES: Record = siteConfiguration.pages
+/** The static pages site.json knows, for the admin's page list. */
+export const SITE_PAGE_PATHS: string[] = Object.keys(siteConfiguration.pages)
/** A static page's title and intro, from site.json's "pages". */
export function sitePage(path: string): PageText {
diff --git a/src/pages/admin/AdminHome.tsx b/src/pages/admin/AdminHome.tsx
index d21c1f6..0a9b70c 100644
--- a/src/pages/admin/AdminHome.tsx
+++ b/src/pages/admin/AdminHome.tsx
@@ -128,8 +128,10 @@ export default function AdminHome() {
))}
{isSuper(user) && (
-
-
+
+ {PANEL_NAV.children.map((item) => (
+
+ ))}
)}
diff --git a/src/pages/admin/EntityEdit.tsx b/src/pages/admin/EntityEdit.tsx
index aa2d85f..83b8b18 100644
--- a/src/pages/admin/EntityEdit.tsx
+++ b/src/pages/admin/EntityEdit.tsx
@@ -87,7 +87,9 @@ export default function EntityEdit() {
useWideAdminPage();
const isNew = id === "new";
- const canWrite = atLeast(user, "editor");
+ // Editor, unless the entity asks for more (site settings:
+ // superadmin), matching the server's writeRole.
+ const canWrite = atLeast(user, manifest?.writeRole ?? "editor");
const canDelete = atLeast(user, "admin");
// Some entities have no slug: the table assigns an integer id, so
diff --git a/src/pages/admin/EntityList.tsx b/src/pages/admin/EntityList.tsx
index ed74ffe..f6ec1f7 100644
--- a/src/pages/admin/EntityList.tsx
+++ b/src/pages/admin/EntityList.tsx
@@ -38,7 +38,7 @@ export default function EntityList() {
// equality test this replaced hid the button from superadmins as
// well as editors, which is the failure mode an == against a
// ladder always produces once a rank is added above it.
- const canWrite = atLeast(user, "editor");
+ const canWrite = atLeast(user, manifest?.writeRole ?? "editor");
const load = useCallback(async () => {
if (!manifest || manifest.singleton) return;
diff --git a/src/pages/admin/adminNav.ts b/src/pages/admin/adminNav.ts
index 2d311af..db1361f 100644
--- a/src/pages/admin/adminNav.ts
+++ b/src/pages/admin/adminNav.ts
@@ -140,14 +140,27 @@ export const TOOLS_NAV = {
],
};
-/* Accounts and server state, not content, which is why it's its
- own area rather than a group of CMS pages. */
+/* Accounts, server state and what the site says about itself: the
+ superadmin's area, its own area rather than a group of CMS pages. */
+export const SITE_SETTINGS = "/admin/site_settings";
+
export const PANEL_NAV = {
- to: ADMIN_PANEL,
label: "Panel",
- blurb: "Accounts, sessions and the state of the server.",
+ blurb: "Only superadmins see this.",
separated: true,
superOnly: true,
+ children: [
+ {
+ to: ADMIN_PANEL,
+ label: "Accounts and server",
+ blurb: "Accounts, sessions and the state of the server.",
+ },
+ {
+ to: SITE_SETTINGS,
+ label: "Site settings",
+ blurb: "The site's name, description, preview image, icons, page titles and search indexing.",
+ },
+ ],
};
export const NAV: any[] = [DATA_NAV, PAGES_NAV, FORMS_NAV, TOOLS_NAV, PANEL_NAV];
@@ -167,6 +180,6 @@ export const target = (item) => item.to ?? item.children?.[0]?.to;
export function areaFor(pathname) {
if (matches(pathname, ADMIN_HOME)) return "home";
- if (matches(pathname, ADMIN_PANEL)) return "panel";
+ if (matches(pathname, ADMIN_PANEL) || matches(pathname, SITE_SETTINGS)) return "panel";
return "cms";
}