Panel → Site settings (migration 035, superadmins only) edits 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. Every value overrides site.json; a blank one falls back to it. The indexing switch is per database, so the dev server can be off while production is on from one build. The server merges the two (siteFor in pageMeta.js) for page metadata, the sitemap and a new /robots.txt route, and writes the merged wording into each page as window.__NGU_SITE__, which site.ts reads so headings match with no extra request. Entities can now require a higher role to save (writeRole), checked on both sides. Panel is a menu group with Accounts and server, and Site settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
2.6 KiB
SQL
62 lines
2.6 KiB
SQL
-- ═══════════════════════════════════════════════════════════════
|
|
-- 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;
|