Skip to content

Give each blog post its own link-preview card - #21

Merged
aharvard merged 2 commits into
mainfrom
claude/blog-og-image-generation-3f3eec
Oct 15, 2026
Merged

aharvard merged 2 commits into
mainfrom
claude/blog-og-image-generation-3f3eec

Conversation

@aharvard

@aharvard aharvard commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Every page on the site, blog posts included, shares one link-preview image: the GAP wordmark. A shared blog link doesn't show which post it is until someone opens it.

Changes

  • Add a local Docusaurus plugin (documentation/plugins/social-cards/) that renders a 1200×630 PNG for each blog post with Satori and resvg. Each card shows the post's title in Bungee on the site's paper and grain, "Governed Artifact Protocol" above a 2px rule, and the authors and date below. It uses only ink and gray. Long titles step down in size and stop at four lines.
  • Generate the cards into static/img/og/ when content loads, so the dev server and the build both serve them. Git ignores that directory, and editing a title regenerates its card.
  • Override BlogPostPage/Metadata so a post without its own image front matter links its card as og:image and twitter:image, with alt text built from the post's title. A post that sets image keeps it, and every other page keeps the default card.
  • Add satori and @resvg/resvg-js as dev dependencies of the documentation site.
image-1792064651918

This is a documentation-site-only change. It changes nothing in the protocol, the schemas, the examples, or the demo.

Verification

  • pnpm docs:test: 19 tests pass, including new ones for the card path and the PNG dimensions.
  • pnpm --dir documentation typecheck
  • pnpm docs:build and DOCS_BASE_URL=/governed-artifact-protocol/ pnpm docs:build: in both, /blog/hello-world has an og:image that points at its card under the base URL and replaces the site default rather than appearing alongside it. Other pages still use img/social-card.png.
  • Rendered cards for both current posts and for a long title with three authors, and checked them by eye.

🤖 Generated with Claude Code

aharvard and others added 2 commits October 15, 2026 07:40
A local Docusaurus plugin draws a 1200x630 PNG per post with Satori and
resvg: the post's title in Bungee on the site's paper and grain, the
protocol's name above a 2px rule, and the authors and date below. Ink and
gray only. Cards are written to static/img/og/ when content loads, so the dev
server and the build both serve them; the directory is generated and ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Override BlogPostPage/Metadata so a post without its own `image` front matter
links its card, and replace the site-wide image alt text with the post's
title. A post that sets `image` keeps it, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aharvard
aharvard requested a review from daveh-beep as a code owner October 15, 2026 11:42
@aharvard
aharvard merged commit 59db86d into main Oct 15, 2026
5 checks passed
@aharvard
aharvard deleted the claude/blog-og-image-generation-3f3eec branch October 15, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant