-
Notifications
You must be signed in to change notification settings - Fork 0
feat(adp): citation-bait schema fields + FAQPage emission #397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b15d37f
feat(adp): citation-bait schema fields + FAQPage emission
julianken 736c1a8
fix(adp): correct Payload partial-data semantics in dedicatedDateModi…
julianken 506d35f
fix(adp): add migration for dedicatedDateModified column
julianken c7f7de8
Merge branch 'main' into feat/adp-citation-schema-fields
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2,395 changes: 2,395 additions & 0 deletions
2,395
migrations/20260517_184638_dedicated_date_modified.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres' | ||
|
|
||
| /** | ||
| * Database Migration: Add dedicatedDateModified to Posts | ||
| * | ||
| * Adds a nullable timestamp column to the `posts` table: | ||
| * - `dedicated_date_modified` — manually set when meaningful content changes | ||
| * ship. Used as the `dateModified` signal in BlogPosting JSON-LD. The | ||
| * beforeChange hook auto-stamps this on body/title/summary edits; | ||
| * rendering falls back to `updated_at` if unset. | ||
| * | ||
| * The column is nullable so existing posts are not broken by the migration — | ||
| * pre-existing rows have NULL and the schema render falls back to | ||
| * `updated_at` until the next meaningful edit triggers the hook. | ||
| * | ||
| * Uses ADD COLUMN IF NOT EXISTS / DROP COLUMN IF EXISTS for idempotency so | ||
| * the migration is safe against databases where the column may already exist | ||
| * (e.g. if `push: true` was used in development). | ||
| * | ||
| * N-1 safe: the previous container revision SELECTs `posts.*` via Drizzle's | ||
| * generated column list. Adding a nullable column does not break old SELECTs | ||
| * (Drizzle's column list is generated from the schema baked into that | ||
| * revision, so it neither reads nor writes the new column). New code reads | ||
| * dedicatedDateModified and falls back to updatedAt when null. | ||
| * | ||
| * Down migration: drops the column. | ||
| */ | ||
|
|
||
| export async function up({ db }: MigrateUpArgs): Promise<void> { | ||
| await db.execute(sql` | ||
| ALTER TABLE "posts" | ||
| ADD COLUMN IF NOT EXISTS "dedicated_date_modified" timestamp(3) with time zone; | ||
| `) | ||
| } | ||
|
|
||
| export async function down({ db }: MigrateDownArgs): Promise<void> { | ||
| await db.execute(sql` | ||
| ALTER TABLE "posts" | ||
| DROP COLUMN IF EXISTS "dedicated_date_modified"; | ||
| `) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // --------------------------------------------------------------------------- | ||
| // ExpertQuoteBlock | ||
| // --------------------------------------------------------------------------- | ||
| // Semantic <blockquote> rendering an authoritative external quote with its | ||
| // attribution linked back to a public source. Sits between the diagram and | ||
| // the decision matrix so the satellite reads as: visual model → external | ||
| // validation → go/no-go. | ||
| // | ||
| // Visibility: not wrapped in <DisclosureSection> by design — the quote | ||
| // must render unconditionally for citation lift. | ||
|
|
||
| import type { Pattern } from "@/data/agentic-design-patterns/types"; | ||
|
|
||
| interface ExpertQuoteBlockProps { | ||
| quote: NonNullable<Pattern["expertQuote"]>; | ||
| } | ||
|
|
||
| export function ExpertQuoteBlock({ quote }: ExpertQuoteBlockProps) { | ||
| return ( | ||
| <section | ||
| id="expert-quote" | ||
| aria-labelledby="expert-quote-heading" | ||
| className="scroll-mt-24" | ||
| > | ||
| <h2 id="expert-quote-heading" className="sr-only"> | ||
| Expert quote | ||
| </h2> | ||
| <figure className="rounded-sm border-l-2 border-accent/60 border-y border-r border-border-subtle bg-surface px-5 py-4"> | ||
| <blockquote className="text-body italic leading-7 text-text-primary [text-wrap:pretty]"> | ||
| {quote.text} | ||
| </blockquote> | ||
| <figcaption className="mt-3 text-meta text-text-tertiary"> | ||
| <span aria-hidden="true">— </span> | ||
| <a | ||
| href={quote.sourceUrl} | ||
| rel="noopener noreferrer" | ||
| target="_blank" | ||
| className="text-accent underline underline-offset-4 hover:text-accent-muted" | ||
| > | ||
| {quote.attribution} | ||
| </a> | ||
| </figcaption> | ||
| </figure> | ||
| </section> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // --------------------------------------------------------------------------- | ||
| // KeyStatisticCallout | ||
| // --------------------------------------------------------------------------- | ||
| // Above-fold callout box that surfaces a single quantitative claim with a | ||
| // linked public source and the year of the claim. Designed to live just | ||
| // before the pattern's diagram so the most citable line of the page is | ||
| // visible in the reader's first viewport. | ||
| // | ||
| // Visibility: not wrapped in <DisclosureSection>. The claim must render | ||
| // unconditionally so AI crawlers and SERP snippets can extract it. | ||
|
|
||
| import type { Pattern } from "@/data/agentic-design-patterns/types"; | ||
|
|
||
| interface KeyStatisticCalloutProps { | ||
| statistic: NonNullable<Pattern["keyStatistic"]>; | ||
| } | ||
|
|
||
| function hostnameOf(url: string): string { | ||
| try { | ||
| return new URL(url).hostname.replace(/^www\./, ""); | ||
| } catch { | ||
| return url; | ||
| } | ||
| } | ||
|
|
||
| export function KeyStatisticCallout({ statistic }: KeyStatisticCalloutProps) { | ||
| return ( | ||
| <section | ||
| id="key-statistic" | ||
| aria-labelledby="key-statistic-heading" | ||
| className="scroll-mt-24" | ||
| > | ||
| <h2 id="key-statistic-heading" className="sr-only"> | ||
| Key statistic | ||
| </h2> | ||
| <div className="rounded-sm border border-border bg-surface p-5"> | ||
| <p className="text-body leading-7 text-text-primary [text-wrap:pretty]"> | ||
| {statistic.claim} | ||
| </p> | ||
| <p className="mt-3 text-meta text-text-tertiary"> | ||
| <a | ||
| href={statistic.sourceUrl} | ||
| rel="noopener noreferrer" | ||
| target="_blank" | ||
| className="font-mono text-xs text-accent underline underline-offset-4 hover:text-accent-muted" | ||
| > | ||
| {hostnameOf(statistic.sourceUrl)} → | ||
| </a> | ||
| <span className="mx-1.5 text-text-tertiary">·</span> | ||
| <span className="font-mono text-xs">{statistic.year}</span> | ||
| </p> | ||
| </div> | ||
| </section> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // --------------------------------------------------------------------------- | ||
| // RelatedQuestionsBlock | ||
| // --------------------------------------------------------------------------- | ||
| // Renders a visible Q&A list as <dl>/<dt>/<dd>. Sits after the decision | ||
| // matrix and before the "In the wild" table. Pairs 1:1 with the FAQPage | ||
| // JSON-LD emitted from generateFaqPageSchema(): the questions and answers | ||
| // in the JSON-LD must also be visible to the user so AI-search engines | ||
| // (Perplexity, ChatGPT, Gemini, Google AI Overviews) can verify the | ||
| // citation signal against rendered content — which means this component | ||
| // must NOT be wrapped in <DisclosureSection>. Note: Google deprecated the | ||
| // FAQ rich result in Search on 2026-05-07; the JSON-LD remains valuable as | ||
| // an AI-search citation signal rather than a SERP enhancement. See | ||
| // https://developers.google.com/search/docs/appearance/structured-data/faqpage. | ||
|
|
||
| import type { Pattern } from "@/data/agentic-design-patterns/types"; | ||
|
|
||
| interface RelatedQuestionsBlockProps { | ||
| questions: NonNullable<Pattern["relatedQuestions"]>; | ||
| } | ||
|
|
||
| export function RelatedQuestionsBlock({ questions }: RelatedQuestionsBlockProps) { | ||
| if (questions.length === 0) return null; | ||
|
|
||
| return ( | ||
| <section | ||
| id="common-questions" | ||
| aria-labelledby="common-questions-heading" | ||
| className="scroll-mt-24" | ||
| > | ||
| <h2 | ||
| id="common-questions-heading" | ||
| className="font-mono text-nav font-semibold uppercase tracking-[0.08em] text-text-tertiary" | ||
| > | ||
| Common questions | ||
| </h2> | ||
| <dl className="mt-4 flex flex-col gap-4"> | ||
| {questions.map((qa, idx) => ( | ||
| <div | ||
| key={idx} | ||
| className="rounded-sm border border-border-subtle bg-surface px-4 py-3" | ||
| > | ||
| <dt className="text-body font-semibold text-text-primary [text-wrap:pretty]"> | ||
| {qa.q} | ||
| </dt> | ||
| <dd className="mt-2 text-body leading-7 text-text-secondary [text-wrap:pretty]"> | ||
| {qa.a} | ||
| </dd> | ||
| </div> | ||
| ))} | ||
| </dl> | ||
| </section> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SUGGESTION — This new visible
Common questionssection (and its siblingKeyStatisticCallout/ExpertQuoteBlock) is rendered with ascroll-mt-24anchor (#common-questions), butPatternStickyRail.tsx'sJUMP_LINKSarray isn't extended to surface them in the "On this page" rail. WhenrelatedQuestionsis later populated for a pattern, readers won't be able to jump to it from the rail.Suggested wiring (in
PatternStickyRail.tsx, replacing the staticJUMP_LINKSconstant with a per-pattern computation):Non-blocking because all 23 patterns are unpopulated for these fields today — but worth wiring before Category I content population so a populated FAQ block doesn't ship without rail navigation.