feat(website): the four templates and the public site

Heritage, Bold, Community and Clean drawing all 26 section variants
with their headers, homepage order and style settings; colours made
safe (WCAG AA) by the backend; fonts and corners from the shared brand
style. Publishing into numbered versions, the content API with live
messages and events and the church profile from Accounts, uploads,
every page kind, simple event pages, Coming soon, 404, sitemap, SEO
basics and the church's JSON-LD. The demo church (npm run demo) and
Playwright e2e: every template's pages pass axe and the SEO checks.
website.sh builds packages/seo. Decision 17 (first Owner) recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 10:59:03 +02:00
co-authored by Claude Opus 5.5
parent 138c73e20c
commit 5ed7201efa
45 changed files with 2704 additions and 63 deletions
+37
View File
@@ -0,0 +1,37 @@
/**
* Search engine basics on every page (ROADMAP-v3 §11): a unique title and description, a
* canonical address, Open Graph with an image, and the church's JSON-LD on home and contact.
*/
import type { Metadata } from "next";
import { churchJsonLd, jsonLdString, pageMeta } from "@crosscode/seo";
import type { Page, Published } from "./types";
export function siteBase(site: Published): URL | undefined {
try {
return site.church?.links.website ? new URL(site.church.links.website) : undefined;
} catch {
return undefined;
}
}
export function pageMetadata(site: Published, page: Page): Metadata {
const name = site.church?.name ?? "Church";
const meta = pageMeta({ title: page.kind === "home" ? null : page.seoTitle || page.title, description: page.description, fallbackDescription: `${name}: ${page.title}` });
const firstImage = page.image ?? Object.values(site.snapshot.media)[0] ?? null;
const image = firstImage?.url.endsWith(".svg") ? null : firstImage;
return {
metadataBase: siteBase(site),
title: page.kind === "home" ? { absolute: page.seoTitle || name } : meta.title,
description: meta.description,
alternates: { canonical: page.path },
openGraph: { type: "website", siteName: name, title: page.kind === "home" ? name : page.title, description: meta.description, url: page.path, locale: "en_ZA", ...(image ? { images: [{ url: image.url, alt: image.alt }] } : site.church?.branding.logoUrl ? { images: [site.church.branding.logoUrl] } : {}) },
twitter: { card: image ? "summary_large_image" : "summary" },
};
}
/** `<script type="application/ld+json">` contents for the church (home and contact pages). */
export function churchLd(site: Published, path: string): string | null {
if (!site.church) return null;
const base = siteBase(site);
return jsonLdString(churchJsonLd(site.church, base ? { url: new URL(path, base).toString() } : {}));
}