Add per-page search metadata, link previews and a sitemap

Page requests now go through the API (routes/pages.js), which fills
the built index.html in for that path before the app loads: title,
description, preview image, canonical URL, and structured data
(Organization, Event, BlogPosting). Shared links preview the page
itself. Unlisted records are noindex; missing ones return 404.
/sitemap.xml lists every public, listed page.

site.json is the one place for the site's name, address, default
description and preview image, and each static page's title and
intro, which the pages now read too. Indexing is switched on:
robots.txt allows all but /admin and /api and names the sitemap. The
browser tab title follows the page.

nginx setup, with a fallback to the plain page if the API is down,
is in docs/seo.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-27 21:21:10 -05:00
parent 71a470b66f
commit 64cb2ec56a
21 changed files with 777 additions and 29 deletions

View file

@ -32,6 +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`.
## Git workflow
- Remote is a self-hosted Forgejo server, not GitHub. Do not use `gh`.