Church details saved through Accounts' church.update (live at once). Settings: Search Console and Bing codes, Coming soon line, menu order. Audit log and recent edits. A made share image, Event / VideoObject / PodcastEpisode / BreadcrumbList structured data, permanent redirects from old page addresses. Saves refused when someone else saved in between; Ministry leaders' events; templates previewed with the church's own content before choosing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
1.7 KiB
TypeScript
30 lines
1.7 KiB
TypeScript
import { ImageResponse } from "next/og";
|
||
import type { NextRequest } from "next/server";
|
||
import { loadContent } from "@/site/load";
|
||
|
||
/**
|
||
* The share image for a page without its own (ROADMAP-v3 §11: "Pages without their own image get a
|
||
* share image generated from the church's logo and colours"): 1200 × 630, the church's colour, its
|
||
* name and the page's title. `?t=` is the title (only shown, never trusted for anything else).
|
||
*/
|
||
export async function GET(request: NextRequest) {
|
||
const c = await loadContent();
|
||
const title = (request.nextUrl.searchParams.get("t") ?? "").slice(0, 90);
|
||
const name = c.church?.name ?? "Our church";
|
||
const rgb = (triple: string) => `rgb(${triple.split(" ").join(",")})`;
|
||
const logo = c.church?.branding.logoUrl;
|
||
return new ImageResponse(
|
||
(
|
||
<div style={{ width: "100%", height: "100%", display: "flex", flexDirection: "column", justifyContent: "space-between", padding: 72, background: rgb(c.palette.brand), color: rgb(c.palette.onBrand) }}>
|
||
<div style={{ display: "flex", alignItems: "center", gap: 24 }}>
|
||
{logo && /^https:\/\//.test(logo) && !logo.endsWith(".svg") ? <img src={logo} alt="" height={88} style={{ borderRadius: 12, background: "white", padding: 8 }} /> : null}
|
||
<div style={{ fontSize: 40, fontWeight: 700 }}>{name}</div>
|
||
</div>
|
||
<div style={{ display: "flex", fontSize: title.length > 40 ? 64 : 80, fontWeight: 800, lineHeight: 1.1 }}>{title || name}</div>
|
||
<div style={{ display: "flex", height: 12, width: 220, background: rgb(c.palette.accent), borderRadius: 6 }} />
|
||
</div>
|
||
),
|
||
{ width: 1200, height: 630, headers: { "Cache-Control": "public, max-age=3600" } },
|
||
);
|
||
}
|