Skip to content

[codex] Add content-rich link preview images#45

Open
tin-computer[bot] wants to merge 1 commit into
mainfrom
codex/link-preview-images
Open

[codex] Add content-rich link preview images#45
tin-computer[bot] wants to merge 1 commit into
mainfrom
codex/link-preview-images

Conversation

@tin-computer

@tin-computer tin-computer Bot commented Jun 12, 2026

Copy link
Copy Markdown

Summary

This changes pasted with.md share links from a generic brand preview image to a generated preview image that shows the shared document title and a compact excerpt from the markdown content.

What changed

  • Added dynamic 1200x630 PNG preview routes for anonymous shares at /og/s/[shareId] and repository shares at /og/r/[token].
  • Updated /s/[shareId] and /r/[token] metadata so Open Graph and Twitter previews use the share-specific title, description, and image route.
  • Added markdown cleanup helpers that strip frontmatter, heading markers, links, images, lists, table separators, code fences, and other markdown noise before building preview text.
  • Kept share pages non-indexable and added X-Robots-Tag: noindex, nofollow, noarchive to the generated image responses.

Why

When people paste a with.md link today, the preview image is the same static /with-md.jpg everywhere. That makes share links feel generic and hides the document context. The new preview shows the actual title and enough content to make the link recognizable before someone opens it.

Validation

  • npm --workspace web run test -- link-preview
  • npm --workspace web run test
  • npm --workspace web run build
  • Local built-app smoke check against /og/s/test-preview and /og/r/test-preview: both returned 200 OK, content-type: image/png, x-robots-tag: noindex, nofollow, noarchive, and 1200x630 PNG output.

Notes

  • The preview image routes use Edge runtime because next/og builds cleanly that way in this app.
  • The repository-share token hash is computed with Web Crypto in the preview helper so the Edge route does not import Node crypto.

@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
with-md-web Ready Ready Preview, Comment Jun 12, 2026 4:49am

Request Review

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