create-freeholder 0.2.0-beta.4 → 0.2.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/template/.changeset/blog-playground-content.md +4 -0
  2. package/dist/template/.changeset/blog-wordpress-structure.md +6 -0
  3. package/dist/template/.changeset/managed-preview-assistant.md +4 -0
  4. package/dist/template/.changeset/native-linux-install.md +6 -0
  5. package/dist/template/.changeset/public-beta-5.md +4 -0
  6. package/dist/template/.changeset/public-beta-6.md +4 -0
  7. package/dist/template/.github/ISSUE_TEMPLATE/bug_report.yml +1 -1
  8. package/dist/template/.github/workflows/release-tarballs.yml +117 -0
  9. package/dist/template/AGENTS.md +15 -2
  10. package/dist/template/Dockerfile +3 -0
  11. package/dist/template/MASTER.md +114 -11
  12. package/dist/template/README.md +1 -1
  13. package/dist/template/app/(admin)/admin/assistant/page.tsx +9 -1
  14. package/dist/template/app/(admin)/admin/blog/PostSettings.tsx +26 -0
  15. package/dist/template/app/(admin)/admin/blog/[kind]/page.tsx +53 -0
  16. package/dist/template/app/(admin)/admin/blog/actions.ts +186 -6
  17. package/dist/template/app/(admin)/admin/blog/comments/page.tsx +25 -0
  18. package/dist/template/app/(admin)/admin/blog/page.tsx +21 -5
  19. package/dist/template/app/(admin)/admin/imports/[id]/page.tsx +2 -0
  20. package/dist/template/app/(admin)/admin/pages/[id]/page.tsx +3 -0
  21. package/dist/template/app/(admin)/assistant-actions.ts +13 -6
  22. package/dist/template/app/(public)/[[...slug]]/ReaderComments.tsx +25 -0
  23. package/dist/template/app/(public)/[[...slug]]/blog-parts.tsx +153 -0
  24. package/dist/template/app/(public)/[[...slug]]/comment-actions.ts +16 -0
  25. package/dist/template/app/(public)/[[...slug]]/page.tsx +182 -18
  26. package/dist/template/app/api/chat/assistant/call/route.ts +35 -0
  27. package/dist/template/db/migrations/0061_blog_structure.sql +89 -0
  28. package/dist/template/db/migrations/0062_blog_reader_comments.sql +24 -0
  29. package/dist/template/db/migrations/meta/_journal.json +14 -0
  30. package/dist/template/deploy/README.md +26 -9
  31. package/dist/template/deploy/blog-wordpress-2026-11-07.md +146 -0
  32. package/dist/template/deploy/docker-selfhost/.env.example +11 -1
  33. package/dist/template/deploy/docker-selfhost/README.md +79 -50
  34. package/dist/template/deploy/docker-selfhost/infra/backup.sh +81 -0
  35. package/dist/template/deploy/docker-selfhost/infra/compose.https.yml +37 -1
  36. package/dist/template/deploy/docker-selfhost/infra/compose.yml +37 -1
  37. package/dist/template/deploy/docker-selfhost/migrate.md +8 -5
  38. package/dist/template/deploy/docker-selfhost/recipe.yaml +9 -10
  39. package/dist/template/deploy/docker-selfhost/selfhost.sh +206 -0
  40. package/dist/template/deploy/docker-selfhost/verify.md +11 -4
  41. package/dist/template/deploy/f-criteria-matrix.md +89 -0
  42. package/dist/template/deploy/linux/.env.example +28 -0
  43. package/dist/template/deploy/linux/README.md +181 -0
  44. package/dist/template/deploy/linux/freeholder +655 -0
  45. package/dist/template/deploy/linux/install.sh +173 -0
  46. package/dist/template/deploy/linux/migrate.md +17 -0
  47. package/dist/template/deploy/linux/recipe.yaml +50 -0
  48. package/dist/template/deploy/linux/share/Caddyfile.template +19 -0
  49. package/dist/template/deploy/linux/share/systemd/freeholder-backup.service +13 -0
  50. package/dist/template/deploy/linux/share/systemd/freeholder-backup.timer +12 -0
  51. package/dist/template/deploy/linux/share/systemd/freeholder.service +41 -0
  52. package/dist/template/deploy/linux/verify.md +22 -0
  53. package/dist/template/deploy/managed-preview-assistant.md +99 -0
  54. package/dist/template/eslint.config.mjs +3 -1
  55. package/dist/template/gitignore.template +1 -0
  56. package/dist/template/locales/ar.json +85 -6
  57. package/dist/template/locales/en.json +83 -4
  58. package/dist/template/locales/es.json +83 -4
  59. package/dist/template/locales/fr.json +85 -6
  60. package/dist/template/next.config.ts +2 -0
  61. package/dist/template/package.json +3 -2
  62. package/dist/template/packages/cli/package.json +1 -1
  63. package/dist/template/packages/create-freeholder/package.json +1 -1
  64. package/dist/template/packages/freeholder-app/package.json +1 -1
  65. package/dist/template/packages/mobile-app/package.json +1 -1
  66. package/dist/template/packages/plugin-kit/package.json +1 -1
  67. package/dist/template/packages/sdk/package.json +1 -1
  68. package/dist/template/packages/sdk/src/generated.ts +177 -9
  69. package/dist/template/packages/sdk/src/version.ts +1 -1
  70. package/dist/template/packages/templates/package.json +1 -1
  71. package/dist/template/proxy.ts +18 -1
  72. package/dist/template/public/managed-assistant/0.1.10/duplex-codec/NOTICE.txt +117 -0
  73. package/dist/template/public/managed-assistant/0.1.10/duplex-codec/audio-output-processor.js +267 -0
  74. package/dist/template/public/managed-assistant/0.1.10/duplex-codec/decoderWorker.min.js +847 -0
  75. package/dist/template/public/managed-assistant/0.1.10/duplex-codec/decoderWorker.min.wasm +0 -0
  76. package/dist/template/public/managed-assistant/0.1.10/duplex-codec/encoderWorker.min.js +1 -0
  77. package/dist/template/public/managed-assistant/0.1.10/manifest.json +12 -0
  78. package/dist/template/public/managed-assistant/0.1.10/pm-ai-duplex-client.js +1376 -0
  79. package/dist/template/scripts/build-release.d.mts +4 -0
  80. package/dist/template/scripts/build-release.mjs +171 -0
  81. package/dist/template/scripts/launch-prepare.mjs +6 -3
  82. package/dist/template/scripts/license-headers.mjs +3 -0
  83. package/dist/template/scripts/recipe-matrix.sh +22 -7
  84. package/dist/template/scripts/verify-wordpress-migration.d.mts +8 -0
  85. package/dist/template/scripts/verify-wordpress-migration.mjs +105 -0
  86. package/dist/template/security/adversarial-audit-2026-10-08.md +1 -1
  87. package/dist/template/src/adapters/ai/types.ts +5 -0
  88. package/dist/template/src/adapters/paradise/assistant.ts +37 -0
  89. package/dist/template/src/adapters/paradise/http.ts +4 -3
  90. package/dist/template/src/adapters/storage/local-mode.ts +54 -0
  91. package/dist/template/src/adapters/storage/local.ts +53 -26
  92. package/dist/template/src/core/contract/json-schema.ts +8 -0
  93. package/dist/template/src/core/demo/playground-inserts.ts +29 -0
  94. package/dist/template/src/core/demo/playground-policy.ts +9 -0
  95. package/dist/template/src/core/doctor/index.ts +19 -10
  96. package/dist/template/src/core/env.ts +8 -1
  97. package/dist/template/src/core/http/csp.ts +10 -2
  98. package/dist/template/src/core/http/csrf-client.ts +10 -0
  99. package/dist/template/src/core/import/service.ts +217 -12
  100. package/dist/template/src/core/import/wordpress.ts +80 -15
  101. package/dist/template/src/core/notifications/service.ts +1 -0
  102. package/dist/template/src/core/retention/registry.ts +2 -0
  103. package/dist/template/src/core/search/registry.ts +2 -0
  104. package/dist/template/src/core/seo/feeds.ts +2 -0
  105. package/dist/template/src/core/seo/jsonld.ts +46 -2
  106. package/dist/template/src/core/seo/legacy-proxy.ts +53 -0
  107. package/dist/template/src/core/seo/meta.ts +10 -7
  108. package/dist/template/src/core/seo/service.ts +14 -1
  109. package/dist/template/src/core/update/preflight.ts +3 -2
  110. package/dist/template/src/core/update/release-declaration.json +1 -1
  111. package/dist/template/src/core/update/service.ts +7 -17
  112. package/dist/template/src/modules/assistant/contract.ts +1 -1
  113. package/dist/template/src/modules/assistant/limits.ts +3 -0
  114. package/dist/template/src/modules/assistant/preview.ts +124 -0
  115. package/dist/template/src/modules/assistant/provider.ts +7 -0
  116. package/dist/template/src/modules/assistant/service.ts +21 -5
  117. package/dist/template/src/modules/cms/blocks/PreviewAssistantCall.tsx +176 -0
  118. package/dist/template/src/modules/cms/blocks/SiteChatClient.tsx +10 -4
  119. package/dist/template/src/modules/cms/blocks/surfaces.tsx +10 -0
  120. package/dist/template/src/modules/cms/blog-comments-schema.ts +27 -0
  121. package/dist/template/src/modules/cms/blog-comments.ts +111 -0
  122. package/dist/template/src/modules/cms/blog-schema.ts +146 -0
  123. package/dist/template/src/modules/cms/blog-service.ts +999 -0
  124. package/dist/template/src/modules/cms/blog.tsx +245 -25
  125. package/dist/template/src/modules/cms/manifest.ts +7 -1
  126. package/dist/template/src/modules/cms/read.ts +18 -0
  127. package/dist/template/src/modules/cms/service.ts +22 -4
  128. package/dist/template/src/modules/cms/tables.ts +2 -0
  129. package/dist/template/src/modules/seed/launch.ts +31 -3
  130. package/dist/template/tests/browser/blog-structure.spec.ts +69 -0
  131. package/dist/template/tests/core/agent-launch.test.ts +7 -2
  132. package/dist/template/tests/core/analytics-consent.test.ts +1 -1
  133. package/dist/template/tests/core/blog-playground.test.ts +106 -0
  134. package/dist/template/tests/core/blog-structure-comments.test.ts +166 -0
  135. package/dist/template/tests/core/client-readiness-security.test.ts +3 -1
  136. package/dist/template/tests/core/csp.test.ts +1 -1
  137. package/dist/template/tests/core/deploy-recipe.test.ts +54 -4
  138. package/dist/template/tests/core/internal-services.test.ts +4 -0
  139. package/dist/template/tests/core/legacy-redirect-proxy.test.ts +59 -0
  140. package/dist/template/tests/core/linux-install.test.ts +169 -0
  141. package/dist/template/tests/core/local-storage-mode.test.ts +29 -0
  142. package/dist/template/tests/core/locale-routing.test.ts +1 -1
  143. package/dist/template/tests/core/playground-cache.test.ts +1 -1
  144. package/dist/template/tests/core/playground.test.ts +3 -3
  145. package/dist/template/tests/core/preview-assistant-call.test.ts +88 -0
  146. package/dist/template/tests/core/private-preview-webhooks.test.ts +1 -1
  147. package/dist/template/tests/core/private-preview.test.ts +1 -1
  148. package/dist/template/tests/core/proxy-locale.test.ts +1 -1
  149. package/dist/template/tests/core/sdk-schema.test.ts +20 -0
  150. package/dist/template/tests/core/seo.test.ts +1 -1
  151. package/dist/template/tests/core/site-chat-client.test.ts +50 -0
  152. package/dist/template/tests/core/storage.test.ts +38 -2
  153. package/dist/template/tests/core/wordpress-import-flow.test.ts +81 -18
  154. package/dist/template/tests/core/wordpress-import.test.ts +25 -12
  155. package/dist/template/tests/core/wordpress-migration-verification.test.ts +37 -0
  156. package/dist/template/tests/modules/preview-assistant.test.ts +164 -0
  157. package/dist/template-manifest.json +490 -175
  158. package/package.json +1 -1
@@ -28,6 +28,7 @@ import { resolveRedirect } from "@/core/seo/service";
28
28
  import {
29
29
  articleJsonLd,
30
30
  breadcrumbJsonLd,
31
+ breadcrumbTrailJsonLd,
31
32
  collectionPageJsonLd,
32
33
  creativeWorkJsonLd,
33
34
  eventJsonLd,
@@ -53,7 +54,8 @@ import { getLocale, getT, requestedLocale } from "../../i18n";
53
54
  import { alternatesFor, localePath, translatedLocales } from "./alternates";
54
55
  import { recordPageView } from "./pageview";
55
56
  import { currentBusiness } from "@/core/settings/read";
56
- import { publishedPage } from "@/modules/cms/read";
57
+ import { blogArchiveAt, blogSettingsCached, postMetaFor, publishedPage } from "@/modules/cms/read";
58
+ import { archiveBlocks, archiveEyebrow, PostByline, PostFooter, type BlogArchive, type PostMeta } from "./blog-parts";
57
59
  import { assignmentsFor } from "@/modules/cms/experiments";
58
60
  import { ANON_HEADER, SESSION_HEADER } from "@/modules/analytics/visitor";
59
61
  import { SESSION_COOKIE } from "@/core/auth/sessions";
@@ -67,6 +69,7 @@ import {
67
69
  } from "@/core/http/csp";
68
70
  import { targetFor } from "@/modules/share/service";
69
71
  import { ShareBar } from "../ShareBar";
72
+ import { ReaderComments } from "./ReaderComments";
70
73
 
71
74
  export const dynamic = "force-dynamic";
72
75
 
@@ -123,6 +126,8 @@ export async function generateMetadata({
123
126
  currentBusiness(),
124
127
  ]);
125
128
  if (!page) {
129
+ const archive = await blogArchiveAt(await pathFor(slug));
130
+ if (archive) return archiveMetadata(archive, business?.name, isFilterQuery(query));
126
131
  // The 404 still needs a document title: an empty <title> is the first
127
132
  // thing a screen reader announces (WCAG 2.4.2).
128
133
  const t = await getT();
@@ -139,15 +144,24 @@ export async function generateMetadata({
139
144
  title?: string;
140
145
  description?: string;
141
146
  ogImage?: string;
147
+ preserveTitle?: boolean;
148
+ preserveDescription?: boolean;
149
+ noindex?: boolean;
150
+ nofollow?: boolean;
151
+ canonical?: string;
152
+ ogTitle?: string;
153
+ ogDescription?: string;
142
154
  };
143
155
  const siteName = business?.name;
144
156
  const title = composeDocumentTitle(
145
157
  seo.title ?? page.title,
146
158
  siteName,
147
159
  page.slug === "",
160
+ seo.preserveTitle === true,
148
161
  );
149
162
  const description = composeDescription(
150
163
  seo.description ?? business?.tagline ?? undefined,
164
+ seo.preserveDescription === true,
151
165
  );
152
166
 
153
167
  // §5 wants the canonical *absolute*, and absolute means configured rather
@@ -170,7 +184,7 @@ export async function generateMetadata({
170
184
  ? locale
171
185
  : (business?.defaultLocale ?? locale);
172
186
 
173
- const canonical = canonicalFor(origin, page.slug, servedLocale, business);
187
+ const canonical = seo.canonical ? new URL(seo.canonical, origin).href : canonicalFor(origin, page.slug, servedLocale, business);
174
188
 
175
189
  // §34: the `ShareTarget` is "canonical URL + auto-generated OG image", so
176
190
  // the social card is the share target's when the owner has written one. It
@@ -181,28 +195,45 @@ export async function generateMetadata({
181
195
  const share = await targetFor
182
196
  .call({ path: page.slug, locale: servedLocale }, ANONYMOUS)
183
197
  .catch(() => null);
184
- const socialTitle = share?.socialTitle ?? title;
185
- const socialDescription = share?.socialDescription ?? description;
198
+ const socialTitle = share?.socialTitle ?? seo.ogTitle ?? title;
199
+ const socialDescription = share?.socialDescription ?? seo.ogDescription ?? description;
186
200
  const ogImage =
187
201
  share?.imageUrl ?? seo.ogImage ?? `${origin}${ogImagePath(page.slug)}`;
188
202
  const filtered = isFilterQuery(query);
203
+ // C2.27: a post is an article to Open Graph, with its dates, author,
204
+ // section and tags, so a shared link reads as one.
205
+ const post = await postMetaFor(page.slug);
189
206
 
190
207
  return {
191
208
  title,
192
209
  description,
193
- robots: filtered ? { index: false, follow: true } : undefined,
210
+ robots: filtered || seo.noindex || seo.nofollow ? { index: !(filtered || seo.noindex), follow: !seo.nofollow } : undefined,
194
211
  alternates: {
195
212
  canonical,
196
213
  ...(alternates ? { languages: alternates } : {}),
197
214
  },
198
- openGraph: {
199
- title: socialTitle,
200
- description: socialDescription,
201
- type: "website",
202
- url: canonical,
203
- siteName: siteName ?? undefined,
204
- images: [{ url: ogImage, width: 1200, height: 630, alt: socialTitle }],
205
- },
215
+ openGraph: post
216
+ ? {
217
+ title: socialTitle,
218
+ description: socialDescription,
219
+ type: "article",
220
+ url: canonical,
221
+ siteName: siteName ?? undefined,
222
+ images: [{ url: ogImage, width: 1200, height: 630, alt: socialTitle }],
223
+ ...(post.publishedAt ? { publishedTime: post.publishedAt.toISOString() } : {}),
224
+ ...(post.modifiedAt ? { modifiedTime: post.modifiedAt.toISOString() } : {}),
225
+ ...(post.author ? { authors: [`${origin}/${post.author.path}`] } : {}),
226
+ ...(post.categories[0] ? { section: post.categories[0].name } : {}),
227
+ ...(post.tags.length ? { tags: post.tags.map((tag) => tag.name) } : {}),
228
+ }
229
+ : {
230
+ title: socialTitle,
231
+ description: socialDescription,
232
+ type: "website",
233
+ url: canonical,
234
+ siteName: siteName ?? undefined,
235
+ images: [{ url: ogImage, width: 1200, height: 630, alt: socialTitle }],
236
+ },
206
237
  twitter: {
207
238
  card: "summary_large_image",
208
239
  title: socialTitle,
@@ -253,6 +284,11 @@ export default async function PublicPage({
253
284
  // intact, and search engines treat 308 as 301's equal. The redirect *row*
254
285
  // still records 301/302, so serving a literal 301 later is a change here and
255
286
  // nowhere else.
287
+ // C2.27: a category, tag or author archive answers at its own path.
288
+ const archive = page ? null : await blogArchiveAt(path);
289
+ if (archive) {
290
+ return renderArchive({ archive, path, locale, t, business, query, nonce });
291
+ }
256
292
  if (!page) {
257
293
  const moved = await resolveRedirect.call({ path, locale }, ANONYMOUS);
258
294
  if (moved) {
@@ -289,7 +325,8 @@ export default async function PublicPage({
289
325
  }
290
326
  const cookieJar = await cookies();
291
327
  const actor = await actorFromToken(cookieJar.get(SESSION_COOKIE)?.value);
292
- const rendered = await renderBlocks(blocks, {
328
+ const post = await postMetaFor(page.slug);
329
+ const renderContext = {
293
330
  locale,
294
331
  t,
295
332
  business: business ? {
@@ -317,7 +354,21 @@ export default async function PublicPage({
317
354
  // a string, and a comparison with an array is simply false.
318
355
  query: { ...query },
319
356
  formReturn: decodeFormReturn(cookieJar.get(FORM_RETURN_COOKIE)?.value),
320
- });
357
+ };
358
+ const localize = (href: string) => (business ? localizeCustomerHref(href, locale, business) : href);
359
+ // A post's byline sits under its title: render the leading H1 on its own,
360
+ // then the byline, then the rest of the body.
361
+ const titled = post && blocks[0]?.type === "heading" && blocks[0].props.level === 1;
362
+ const rendered = titled
363
+ ? [
364
+ ...(await renderBlocks([blocks[0]!], renderContext)),
365
+ <PostByline key="post-byline" meta={post} t={t} locale={locale} href={localize} />,
366
+ ...(await renderBlocks(blocks.slice(1), renderContext)),
367
+ ]
368
+ : [
369
+ ...(post ? [<PostByline key="post-byline" meta={post} t={t} locale={locale} href={localize} />] : []),
370
+ ...(await renderBlocks(blocks, renderContext)),
371
+ ];
321
372
 
322
373
  // Structured data comes from two places, and neither is a setting an owner
323
374
  // has to find: the page's own identity (§5 — WebSite and the business on the
@@ -348,7 +399,10 @@ export default async function PublicPage({
348
399
  localBusiness ?? organizationJsonLd(origin, facts),
349
400
  ]
350
401
  : []),
351
- ...(path !== ""
402
+ ...(post
403
+ ? postJsonLd({ origin, path, title: page.title, seo: page.seo, post, publisher: facts?.name ?? null, t })
404
+ : []),
405
+ ...(path !== "" && !post
352
406
  ? [
353
407
  breadcrumbJsonLd(origin, path, (segmentPath) =>
354
408
  segmentPath === ""
@@ -359,7 +413,7 @@ export default async function PublicPage({
359
413
  ),
360
414
  ].filter((entry) => entry !== undefined)
361
415
  : []),
362
- ...(await entityJsonLd({
416
+ ...(post ? [] : await entityJsonLd({
363
417
  origin,
364
418
  path,
365
419
  title: page.title,
@@ -382,7 +436,11 @@ export default async function PublicPage({
382
436
  dangerouslySetInnerHTML={{ __html: serializeJsonLd(entry) }}
383
437
  />
384
438
  ))}
385
- <article className="grid gap-8">{rendered}</article>
439
+ <article className="grid gap-8">
440
+ {rendered}
441
+ {post ? <PostFooter meta={post} t={t} href={localize} /> : null}
442
+ {post ? <ReaderComments pageValue={typeof query.commentPage === "string" ? query.commentPage : undefined} pageId={page.id} enabled={post.commentsEnabled} returnTo={localize(`/${path}`)} result={typeof query.comment === "string" ? query.comment : undefined} locale={locale} t={t} /> : null}
443
+ </article>
386
444
  {/*
387
445
  §34: sharing is "a property of every entity with a public face", so it
388
446
  is rendered by the one public route rather than added per page. The
@@ -400,6 +458,112 @@ export default async function PublicPage({
400
458
  );
401
459
  }
402
460
 
461
+ /** Title, description, canonical and robots for a blog archive (C2.27). */
462
+ function archiveMetadata(archive: BlogArchive, siteName: string | undefined, filtered: boolean): Metadata {
463
+ const origin = siteOrigin();
464
+ const canonical = `${origin}/${archive.path}`;
465
+ const title = composeDocumentTitle(archive.seo.title ?? archive.name, siteName, false);
466
+ const description = composeDescription(archive.seo.description ?? archive.description ?? undefined);
467
+ return {
468
+ title,
469
+ description,
470
+ robots: archive.seo.noindex || filtered ? { index: false, follow: true } : undefined,
471
+ alternates: { canonical },
472
+ openGraph: { title, description, type: "website", url: canonical, siteName },
473
+ twitter: { card: "summary", title, description },
474
+ };
475
+ }
476
+
477
+ async function renderArchive(input: {
478
+ archive: BlogArchive;
479
+ path: string;
480
+ locale: string;
481
+ t: Awaited<ReturnType<typeof getT>>;
482
+ business: Awaited<ReturnType<typeof currentBusiness>>;
483
+ query: Record<string, string | string[] | undefined>;
484
+ nonce: string | undefined;
485
+ }) {
486
+ const { archive, path, locale, t, business, query, nonce } = input;
487
+ await recordPageView(`/${path}`, locale, query);
488
+ const settings = await blogSettingsCached();
489
+ const cookieJar = await cookies();
490
+ const actor = await actorFromToken(cookieJar.get(SESSION_COOKIE)?.value);
491
+ const rendered = await renderBlocks(archiveBlocks(archive, settings.postsPerPage), {
492
+ locale,
493
+ t,
494
+ business: business
495
+ ? { name: business.name, tagline: business.tagline, defaultLocale: business.defaultLocale, enabledLocales: business.enabledLocales }
496
+ : null,
497
+ path: `/${path}`,
498
+ actor,
499
+ query: { ...query },
500
+ cspNonce: nonce,
501
+ localizeHref: business ? (href: string) => localizeCustomerHref(href, locale, business) : undefined,
502
+ });
503
+ const origin = siteOrigin();
504
+ const blog = await publishedPage("blog", locale);
505
+ const jsonLd = [
506
+ collectionPageJsonLd({
507
+ name: archive.name,
508
+ url: `${origin}/${archive.path}`,
509
+ description: archive.seo.description ?? archive.description,
510
+ }),
511
+ breadcrumbTrailJsonLd([
512
+ { name: business?.name ?? t("home.brand"), item: `${origin}/` },
513
+ ...(blog ? [{ name: blog.title, item: `${origin}/blog` }] : []),
514
+ ...archive.trail.map((step) => ({ name: step.name, item: `${origin}/${step.path}` })),
515
+ { name: archive.name, item: `${origin}/${archive.path}` },
516
+ ]),
517
+ ].filter((entry) => entry !== undefined);
518
+ return (
519
+ <>
520
+ {jsonLd.map((entry, i) => (
521
+ <script key={i} nonce={nonce} type="application/ld+json" dangerouslySetInnerHTML={{ __html: serializeJsonLd(entry) }} />
522
+ ))}
523
+ <p className="text-sm font-semibold uppercase tracking-wide text-ink-muted">{archiveEyebrow(archive, t)}</p>
524
+ <div className="grid gap-8">{rendered}</div>
525
+ </>
526
+ );
527
+ }
528
+
529
+ /** BlogPosting and its breadcrumb: Home › Blog › primary category › post. */
530
+ function postJsonLd(input: {
531
+ origin: string;
532
+ path: string;
533
+ title: string;
534
+ seo: unknown;
535
+ post: PostMeta;
536
+ publisher: string | null;
537
+ t: Awaited<ReturnType<typeof getT>>;
538
+ }) {
539
+ const { origin, path, post } = input;
540
+ const seo = (input.seo ?? {}) as { title?: string; description?: string; ogImage?: string };
541
+ const url = `${origin}/${path}`;
542
+ const primary = post.categories[0];
543
+ return [
544
+ articleJsonLd({
545
+ type: "BlogPosting",
546
+ headline: input.title,
547
+ url,
548
+ description: seo.description ?? null,
549
+ datePublished: post.publishedAt,
550
+ dateModified: post.modifiedAt ?? post.publishedAt ?? undefined,
551
+ authorName: post.author?.name ?? input.publisher,
552
+ authorUrl: post.author ? `${origin}/${post.author.path}` : null,
553
+ section: primary?.name ?? null,
554
+ keywords: post.tags.map((tag) => tag.name),
555
+ image: seo.ogImage ?? null,
556
+ publisherName: input.publisher,
557
+ }),
558
+ breadcrumbTrailJsonLd([
559
+ { name: input.publisher ?? input.t("home.brand"), item: `${origin}/` },
560
+ { name: input.t("blog.title"), item: `${origin}/blog` },
561
+ ...(primary ? [{ name: primary.name, item: `${origin}/${primary.path}` }] : []),
562
+ { name: input.title, item: url },
563
+ ]),
564
+ ].filter((entry) => entry !== undefined);
565
+ }
566
+
403
567
  /**
404
568
  * Page-type structured data beyond the site/business/breadcrumb.
405
569
  *
@@ -0,0 +1,35 @@
1
+ // Copyright (C) 2026 Tony Aly
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { readCookie } from "@/core/http/cookies";
4
+ import { readBoundedText } from "@/core/http/body";
5
+ import { serviceRoute } from "@/core/http/route";
6
+ import { SITE_CHAT_COOKIE } from "@/core/messaging/chat-cookie";
7
+ import { ServiceError } from "@/core/service";
8
+ import { previewCall } from "@/modules/assistant/service";
9
+ import { env } from "@/core/env";
10
+ import { json } from "@/core/http/respond";
11
+
12
+ export const dynamic = "force-dynamic";
13
+ const control = serviceRoute(previewCall, {
14
+ readInput: async (request) => {
15
+ const token = readCookie(request, SITE_CHAT_COOKIE);
16
+ if (!token) throw new ServiceError("not_found", "There is no active chat in this browser.");
17
+ const raw = await readBoundedText(request, 12288);
18
+ let body: unknown;
19
+ try { body = JSON.parse(raw); } catch { throw new ServiceError("validation", "Invalid call request."); }
20
+ if (!body || typeof body !== "object" || Array.isArray(body) || "token" in body) {
21
+ throw new ServiceError("validation", "Invalid call request.");
22
+ }
23
+ return { ...body, token };
24
+ },
25
+ present: (body) => ({ body, headers: { "cache-control": "private, no-store" } }),
26
+ });
27
+
28
+ export function POST(request: Request): Promise<Response> {
29
+ const origin = request.headers.get("origin");
30
+ if (request.headers.get("sec-fetch-site") === "cross-site"
31
+ || (origin && ![new URL(request.url).origin, new URL(env().APP_URL).origin].includes(origin))) {
32
+ return Promise.resolve(json({ error: "Cross-site chat refused." }, 403));
33
+ }
34
+ return control(request);
35
+ }
@@ -0,0 +1,89 @@
1
+ -- Copyright (C) 2026 Tony Aly
2
+ -- SPDX-License-Identifier: Apache-2.0
3
+ -- C2.27/C2.28 (MASTER.md §43): blog posts, categories, tags and authors.
4
+ -- New tables only: the previous release never reads them, so rollback is
5
+ -- safe. A post is still a `pages` row; `blog_posts` marks it as one.
6
+ CREATE TABLE "blog_settings" (
7
+ "key" text PRIMARY KEY DEFAULT 'site' NOT NULL,
8
+ "category_base" text DEFAULT 'blog/category' NOT NULL,
9
+ "tag_base" text DEFAULT 'blog/tag' NOT NULL,
10
+ "author_base" text DEFAULT 'blog/author' NOT NULL,
11
+ "posts_per_page" integer DEFAULT 12 NOT NULL,
12
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
13
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
14
+ );
15
+ --> statement-breakpoint
16
+ CREATE TABLE "blog_authors" (
17
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
18
+ "slug" text NOT NULL,
19
+ "path" text NOT NULL,
20
+ "name" text NOT NULL,
21
+ "bio" text,
22
+ "email" text,
23
+ "user_id" uuid,
24
+ "seo" jsonb DEFAULT '{}'::jsonb NOT NULL,
25
+ "source" text DEFAULT 'admin' NOT NULL,
26
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
27
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
28
+ );
29
+ --> statement-breakpoint
30
+ ALTER TABLE "blog_authors" ADD CONSTRAINT "blog_authors_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;
31
+ --> statement-breakpoint
32
+ CREATE UNIQUE INDEX "blog_authors_slug_idx" ON "blog_authors" USING btree ("slug");
33
+ --> statement-breakpoint
34
+ CREATE UNIQUE INDEX "blog_authors_path_idx" ON "blog_authors" USING btree ("path");
35
+ --> statement-breakpoint
36
+ CREATE UNIQUE INDEX "blog_authors_user_idx" ON "blog_authors" USING btree ("user_id") WHERE "blog_authors"."user_id" is not null;
37
+ --> statement-breakpoint
38
+ CREATE TABLE "blog_terms" (
39
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
40
+ "taxonomy" text NOT NULL,
41
+ "slug" text NOT NULL,
42
+ "path" text NOT NULL,
43
+ "name" text NOT NULL,
44
+ "description" text,
45
+ "parent_id" uuid,
46
+ "position" integer DEFAULT 0 NOT NULL,
47
+ "seo" jsonb DEFAULT '{}'::jsonb NOT NULL,
48
+ "source" text DEFAULT 'admin' NOT NULL,
49
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
50
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
51
+ CONSTRAINT "blog_terms_taxonomy_allowed" CHECK ("blog_terms"."taxonomy" in ('category', 'tag'))
52
+ );
53
+ --> statement-breakpoint
54
+ ALTER TABLE "blog_terms" ADD CONSTRAINT "blog_terms_parent_id_blog_terms_id_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."blog_terms"("id") ON DELETE set null ON UPDATE no action;
55
+ --> statement-breakpoint
56
+ CREATE UNIQUE INDEX "blog_terms_slug_idx" ON "blog_terms" USING btree ("taxonomy","slug");
57
+ --> statement-breakpoint
58
+ CREATE UNIQUE INDEX "blog_terms_path_idx" ON "blog_terms" USING btree ("path");
59
+ --> statement-breakpoint
60
+ CREATE INDEX "blog_terms_parent_idx" ON "blog_terms" USING btree ("parent_id");
61
+ --> statement-breakpoint
62
+ CREATE TABLE "blog_posts" (
63
+ "page_id" uuid PRIMARY KEY NOT NULL,
64
+ "author_id" uuid,
65
+ "comments_enabled" boolean DEFAULT true NOT NULL,
66
+ "source_modified_at" timestamp with time zone,
67
+ "source" text DEFAULT 'admin' NOT NULL,
68
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
69
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
70
+ );
71
+ --> statement-breakpoint
72
+ ALTER TABLE "blog_posts" ADD CONSTRAINT "blog_posts_page_id_pages_id_fk" FOREIGN KEY ("page_id") REFERENCES "public"."pages"("id") ON DELETE cascade ON UPDATE no action;
73
+ --> statement-breakpoint
74
+ ALTER TABLE "blog_posts" ADD CONSTRAINT "blog_posts_author_id_blog_authors_id_fk" FOREIGN KEY ("author_id") REFERENCES "public"."blog_authors"("id") ON DELETE set null ON UPDATE no action;
75
+ --> statement-breakpoint
76
+ CREATE INDEX "blog_posts_author_idx" ON "blog_posts" USING btree ("author_id");
77
+ --> statement-breakpoint
78
+ CREATE TABLE "blog_post_terms" (
79
+ "page_id" uuid NOT NULL,
80
+ "term_id" uuid NOT NULL,
81
+ "position" integer DEFAULT 0 NOT NULL,
82
+ CONSTRAINT "blog_post_terms_page_id_term_id_pk" PRIMARY KEY("page_id","term_id")
83
+ );
84
+ --> statement-breakpoint
85
+ ALTER TABLE "blog_post_terms" ADD CONSTRAINT "blog_post_terms_page_id_blog_posts_page_id_fk" FOREIGN KEY ("page_id") REFERENCES "public"."blog_posts"("page_id") ON DELETE cascade ON UPDATE no action;
86
+ --> statement-breakpoint
87
+ ALTER TABLE "blog_post_terms" ADD CONSTRAINT "blog_post_terms_term_id_blog_terms_id_fk" FOREIGN KEY ("term_id") REFERENCES "public"."blog_terms"("id") ON DELETE cascade ON UPDATE no action;
88
+ --> statement-breakpoint
89
+ CREATE INDEX "blog_post_terms_term_idx" ON "blog_post_terms" USING btree ("term_id");
@@ -0,0 +1,24 @@
1
+ -- Copyright (C) 2026 Tony Aly
2
+ -- SPDX-License-Identifier: Apache-2.0
3
+ -- C2.29: public moderated reader comments, distinct from editorial annotations.
4
+ ALTER TABLE blog_settings ADD COLUMN comments_enabled boolean NOT NULL DEFAULT true;
5
+ --> statement-breakpoint
6
+ CREATE TABLE blog_reader_comments (
7
+ id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
8
+ page_id uuid NOT NULL REFERENCES pages(id) ON DELETE CASCADE,
9
+ parent_id uuid REFERENCES blog_reader_comments(id) ON DELETE SET NULL,
10
+ contact_id uuid REFERENCES contacts(id) ON DELETE SET NULL,
11
+ author_name text NOT NULL,
12
+ body text NOT NULL,
13
+ status text NOT NULL DEFAULT 'pending' CONSTRAINT blog_reader_comments_status_allowed CHECK(status IN ('pending','approved','spam','trash')),
14
+ source text NOT NULL DEFAULT 'reader',
15
+ external_id text,
16
+ created_at timestamptz NOT NULL DEFAULT now(),
17
+ updated_at timestamptz NOT NULL DEFAULT now()
18
+ );
19
+ --> statement-breakpoint
20
+ CREATE INDEX blog_reader_comments_page_status_idx ON blog_reader_comments(page_id,status,created_at);
21
+ --> statement-breakpoint
22
+ CREATE INDEX blog_reader_comments_contact_idx ON blog_reader_comments(contact_id);
23
+ --> statement-breakpoint
24
+ CREATE UNIQUE INDEX blog_reader_comments_source_external_idx ON blog_reader_comments(source,external_id) WHERE external_id IS NOT NULL;
@@ -428,6 +428,20 @@
428
428
  "when": 1793310000040,
429
429
  "tag": "0060_mail_preview_outbox",
430
430
  "breakpoints": true
431
+ },
432
+ {
433
+ "idx": 61,
434
+ "version": "7",
435
+ "when": 1793310000041,
436
+ "tag": "0061_blog_structure",
437
+ "breakpoints": true
438
+ },
439
+ {
440
+ "idx": 62,
441
+ "version": "7",
442
+ "when": 1793310000042,
443
+ "tag": "0062_blog_reader_comments",
444
+ "breakpoints": true
431
445
  }
432
446
  ]
433
447
  }
@@ -12,18 +12,35 @@ in core, never a fork (§18).
12
12
  | [`replit`](replit/) | 1 | Replit Postgres | Replit Object Storage | $25 |
13
13
  | [`railway`](railway/) | 1 | Railway Postgres | S3-compatible | $25 |
14
14
  | [`render`](render/) | 1 | Render Postgres | S3-compatible | $28 |
15
- | [`docker-selfhost`](docker-selfhost/) | 1 | Compose Postgres | S3 / MinIO (dev) | $20 |
15
+ | [`docker-selfhost`](docker-selfhost/) | 1 | Compose Postgres | Docker volume or S3 | $12–24 |
16
+ | [`linux`](linux/) (no Docker) | 2 | Distribution Postgres | Server disk or S3 | $12–24 |
16
17
 
17
- ## The storage mandate
18
+ **By hand, without an AI assistant:** [`linux`](linux/) is the WordPress-style
19
+ path: download `install.sh` from a release, run it on any Ubuntu or Debian
20
+ server, open the claim link it prints. It needs no Docker, Node, pnpm or
21
+ checkout. [`docker-selfhost`](docker-selfhost/) is the same on a host that
22
+ already runs Docker.
18
23
 
19
- Production media lives in managed object storage, never on instance disk
20
- (§18). Media is the least recoverable asset a business has: a dead droplet or a
21
- wiped container must never take the photo archive with it, and object storage
22
- makes moving providers a bucket sync rather than a rescue operation.
24
+ ## The storage mandate
23
25
 
24
- The `local` adapter is development-only and **refuses to start** with
25
- `NODE_ENV=production` unless overridden with `FREEHOLDER_UNSAFE_LOCAL_STORAGE=1`
26
- — a flag named to be embarrassing in a config review.
26
+ Production media must live somewhere a rebuild cannot take it (§18). On
27
+ platforms with no durable disk (App Platform, Render, Railway, Replit) that is
28
+ object storage, and the recipe pins it. Media is the least recoverable asset a
29
+ business has, and object storage makes moving providers a bucket sync rather
30
+ than a rescue operation.
31
+
32
+ A single-server install may instead keep media on its own disk (C3.44): the
33
+ `linux` recipe's `/var/lib/freeholder/media` and the `docker-selfhost` media
34
+ volume. Both are outside the replaceable release, kept across updates and
35
+ included in the nightly backup, which is why they are supported. The trade-off
36
+ is that losing the server loses the media unless its backups were copied off
37
+ it, and a second app server cannot share it. Each recipe's README says how to
38
+ copy backups elsewhere and how to move media to S3 later.
39
+
40
+ The `local` adapter **refuses to start** with `NODE_ENV=production` unless
41
+ `LOCAL_STORAGE_ROOT` names such an absolute, existing directory. The legacy
42
+ `FREEHOLDER_UNSAFE_LOCAL_STORAGE=1` override for an implicit directory remains,
43
+ named to be embarrassing in a config review.
27
44
 
28
45
  ## Adding a recipe
29
46