app: announcements, devotionals and events' screens; @crosscode/seo 1.1.0 (APP-1.0-PLAN §5-§7)
Public pages: Home with today's devotional, the latest announcements (pinned first) and what's on; Announcements and each one's page (markdown without HTML, a button, Article JSON-LD; members-only ones ask for a sign-in and are noindex); Devotional (the passage in full with its copyright line, Read in YouVersion, the prayer), each day's page, the archive by month and the Acknowledgements; Events and each one's page (Register on the Events site for Cross Events', a canonical to the origin, Event JSON-LD on the App's own). A sitemap of the public pages, named in robots.txt. Admin: Announcements (schedule, end, pin, campus, who sees it, also send it), Events (simple events, Linked products: publish and show events from), and Devotionals (Cross Code's or our own, Sync now, a month's days, writing, the CSV import with its preview, keep or replace days already filled). @crosscode/seo 1.1.0: articleJsonLd. The backend gives the App's own address and the sitemap's list, and a simple event's crosscode.event/1 for its page. Checked in a browser on a throwaway PostgreSQL: the pages for a visitor, the JSON-LD, a members-only announcement asking for a sign-in, the sitemap, a Content admin publishing an announcement and a Devotional writer saving one; no page errors. 94 backend tests, 19 seo tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { articleJsonLd, jsonLdString, type ArticleJsonLdInput } from "@crosscode/seo";
|
||||
import { plain, type Announcement, type Devotional } from "@/lib/content";
|
||||
import type { AppInfo } from "@/lib/load";
|
||||
import { truncate } from "@/lib/text";
|
||||
|
||||
/** Article JSON-LD for a public devotional or announcement (APP-1.0-PLAN §11); never on members-only pages. */
|
||||
export function ArticleJsonLd(props: ArticleJsonLdInput) {
|
||||
return <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: jsonLdString(articleJsonLd(props)) }} />;
|
||||
}
|
||||
|
||||
const publisherOf = (app: AppInfo) => ({ name: app.church!.name, url: app.church!.links.website ?? app.url, logoUrl: app.church!.branding.logoUrl });
|
||||
|
||||
export function DevotionalJsonLd({ d, app }: { d: Devotional; app: AppInfo }) {
|
||||
if (d.membersOnly || !app.church) return null;
|
||||
return (
|
||||
<ArticleJsonLd
|
||||
url={`${app.url}/devotional/${d.date}`} headline={d.title} datePublished={d.date} dateModified={d.updatedAt} author={d.author} about={d.passage.reference}
|
||||
description={truncate(plain(d.body), 155)} publisher={publisherOf(app)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function AnnouncementJsonLd({ a, app }: { a: Announcement; app: AppInfo }) {
|
||||
if (a.membersOnly || !app.church) return null;
|
||||
return (
|
||||
<ArticleJsonLd
|
||||
url={`${app.url}/announcements/${a.slug}`} headline={a.title} datePublished={a.publishedAt} dateModified={a.updatedAt} imageUrl={a.imageUrl}
|
||||
description={truncate(plain(a.body), 155)} publisher={publisherOf(app)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user