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>
45 lines
2.0 KiB
TypeScript
45 lines
2.0 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { notFound } from "next/navigation";
|
|
import { loadPublished } from "@/site/load";
|
|
import { fmtDate, fmtTime, Img } from "@/site/parts";
|
|
import { siteBase } from "@/site/meta";
|
|
import { Shell } from "@/site/Shell";
|
|
|
|
type Props = { params: Promise<{ slug: string }> };
|
|
|
|
async function find(slug: string) {
|
|
const site = await loadPublished();
|
|
const event = site?.events.find((e) => e.from === "website" && e.url === `/events/${slug}`) ?? null;
|
|
return { site, event };
|
|
}
|
|
|
|
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
const { site, event } = await find((await params).slug);
|
|
if (!site || !event) return { robots: { index: false } };
|
|
return { metadataBase: siteBase(site), title: event.title, description: event.summary ?? undefined, alternates: { canonical: event.url } };
|
|
}
|
|
|
|
/** A simple event made in the Website (§8). Cross Events' own events link to Cross Events instead. */
|
|
export default async function EventPage({ params }: Props) {
|
|
const { site, event } = await find((await params).slug);
|
|
if (!site || !event) notFound();
|
|
const zone = site.church?.timezone ?? "Africa/Johannesburg";
|
|
const events = site.snapshot.pages.find((p) => p.kind === "events");
|
|
return (
|
|
<Shell site={site} path={event.url}>
|
|
<article className="cc-section">
|
|
<div className="cc-wrap grid gap-10 md:grid-cols-2">
|
|
<Img image={event.image} priority />
|
|
<div>
|
|
<p className="cc-eyebrow">{fmtDate(event.startsAt, zone, { weekday: "long", day: "numeric", month: "long", year: "numeric" })}{!event.allDay && `, ${fmtTime(event.startsAt, zone)}`}</p>
|
|
<h1 className="cc-h1 mt-2">{event.title}</h1>
|
|
{event.location && <p className="cc-muted mt-3 text-lg">{event.location}</p>}
|
|
{event.summary && <p className="cc-prose mt-6">{event.summary}</p>}
|
|
{events && <a href={events.path} className="cc-link mt-8 inline-block font-semibold">All events</a>}
|
|
</div>
|
|
</div>
|
|
</article>
|
|
</Shell>
|
|
);
|
|
}
|