Skip to content

feat(docs): add og:image social card for link previews#44

Open
iliassjabali wants to merge 4 commits intomainfrom
feat/social-card
Open

feat(docs): add og:image social card for link previews#44
iliassjabali wants to merge 4 commits intomainfrom
feat/social-card

Conversation

@iliassjabali
Copy link
Copy Markdown
Collaborator

@iliassjabali iliassjabali commented Apr 11, 2026

Closes #31.

Summary

  • Add scripts/generate-og-card.ts that uses satori + @resvg/resvg-js to render a 1280x640 PNG from a plain-object tree. No JSX config needed. Run with pnpm og-card. Output goes to docs/public/og-card.png so VitePress serves it at /agentspec/og-card.png.
  • Add a vitest spec that asserts PNG magic bytes and that the IHDR chunk reports 1280x640. Wired into root pnpm test via a new test:scripts target so CI catches regressions.
  • Wire og:* and twitter:* meta tags in docs/.vitepress/config.mts pointing at https://agents-oss.github.io/agentspec/og-card.png. A comment in the config calls out that the absolute URLs should be updated once the agentspec.io custom domain goes live.
  • Commit the generated PNG so the GitHub Pages build does not need to run the generator and reviewers can see the actual image in the diff.

Visual

The card is text-only for v1 (no logo asset exists yet): a rounded { } logomark tile with the brand gradient, the AgentSpec wordmark, the tagline "The universal manifest for AI agents", four feature pills (validate / health-check / audit / generate), and the docs URL as a footer. Dark background so it reads on both light and dark chat surfaces.

Manual follow-up (cannot be scripted)

After this merges, a repo admin needs to upload the same PNG through the GitHub dashboard so the github.com/agents-oss/agentspec link previews get the branded card:

Settings -> Social preview -> Upload an image -> docs/public/og-card.png

Test plan

  • pnpm test:scripts green (asserts PNG validity + 1280x640 dimensions)
  • pnpm og-card regenerates the PNG deterministically
  • npx vitepress build docs copies the PNG into dist/og-card.png and includes the meta tags in the rendered HTML (verified locally)
  • After Pages redeploys, run the live URL through https://www.opengraph.xyz/ and https://cards-dev.twitter.com/validator
  • After the manual Social preview upload, confirm the repo URL shows the branded card in a Slack DM or tweet draft

Closes #31.

- Add scripts/generate-og-card.ts using satori + resvg to render
  a 1280x640 PNG from a plain-object tree (no JSX config needed).
  Output: docs/public/og-card.png. Run with `pnpm og-card`.
- Add a vitest spec that asserts PNG magic bytes and dimensions.
  Wired into root `pnpm test` via a new `test:scripts` target.
- Wire og:* and twitter:* meta tags in docs/.vitepress/config.mts
  pointing at https://agents-oss.github.io/agentspec/og-card.png.

Manual follow-up (cannot be scripted): upload the same PNG to
Settings -> Social preview on the GitHub repo.
@iliassjabali iliassjabali marked this pull request as draft April 11, 2026 23:43
Swap the placeholder `{ }` tile for the transparent logomark at
logo/agentspec.png and shift the accent palette from indigo/cyan
to the brand purple family (#A855F7 -> #5A2387) to match.

Validated locally with Playwright MCP against a vitepress preview
build: all og:* and twitter:* meta tags render correctly and the
PNG loads at 1280x640.
The vitest.config.ts file was moved to scripts/ in 91c4b0f so that
vitest's upward config search from packages/* would not inherit the
`include: ['scripts/**/*.test.ts']` pattern and override the default
include used by config-less packages (adapter-claude, cli, mcp-server).
That move fixed the inheritance, but the root `test:scripts` npm script
was still pointing at the old path, so `pnpm test:scripts` in CI failed
to find the moved config.

Update the script to reference the new location. Add a docblock on the
config explaining why it lives under scripts/ so the layout does not
regress.
@iliassjabali
Copy link
Copy Markdown
Collaborator Author

@skokaina once this merges, could you upload docs/public/og-card.png as the GitHub repo social preview? It is the one thing in issue #31 that cannot be scripted, and it needs admin access on agents-oss/agentspec.

Steps:

  1. Go to https://github.com/agents-oss/agentspec/settings
  2. Scroll to Social preview
  3. Click Edit -> Upload an image
  4. Pick docs/public/og-card.png from this branch (or just grab the file from the PR diff)

After that, pasting the repo URL into a Slack DM or a draft tweet should show the branded card. The docs site will get the same card automatically via the og:image meta tag once Pages redeploys.

@iliassjabali iliassjabali marked this pull request as ready for review April 12, 2026 00:29
@iliassjabali iliassjabali requested a review from skokaina April 12, 2026 00:29
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.

Add social card (og:image) for link previews

1 participant