Skip to content

feat(blog): wire per-post OG/Twitter image into the blog route - #114

Merged
Smetools merged 1 commit into
mainfrom
hassan/blog-og-meta-20260629
Jun 29, 2026
Merged

feat(blog): wire per-post OG/Twitter image into the blog route#114
Smetools merged 1 commit into
mainfrom
hassan/blog-og-meta-20260629

Conversation

@Smetools

Copy link
Copy Markdown
Collaborator

What

The blog post route (app/blog/[slug]/page.tsx) set no openGraph.images and read no image field, so blog shares rendered a card with no image. This wires per-post OG + Twitter images.

How

  • lib/blog.tsBlogPostMeta gains ogImage: string | null. resolveOgImage(slug, data) takes an explicit og_image/ogImage frontmatter override, else the per-post asset convention public/blog/<slug>/og.{webp,png}. Root-relative path or null.
  • blog/[slug]/page.tsxgenerateMetadata adds openGraph.images + a twitter summary_large_image card only when an OG image resolves. No asset → unchanged (card stays summary, no image) — zero regression for existing posts.

Why convention-driven

Posts auto-pick up their og.webp with no frontmatter and no publish-draft.mjs change. The how-to-do-meeting-minutes post (PR #113) already ships public/blog/how-to-do-meeting-minutes/og.webp, so it gets a real card the moment both merge.

Verification

npx tsc --noEmit0 errors. Additive + conditional; dormant for every post that has no OG asset.

Security

Build-time only. fs.existsSync on an author-controlled slug (trusted content, not runtime user input), read-only existence check. No runtime attack surface.

🤖 Generated with Claude Code

The blog post route set no openGraph.images and read no image field, so social
shares had no card image. Now:

- lib/blog.ts: BlogPostMeta gains `ogImage`. resolveOgImage() takes an explicit
  `og_image`/`ogImage` frontmatter override, else the per-post asset convention
  public/blog/<slug>/og.{webp,png}. Returns a root-relative path or null.
- blog/[slug]/page.tsx: generateMetadata sets openGraph.images + a twitter
  summary_large_image card ONLY when an OG image resolves; otherwise behavior is
  unchanged (no regression for posts without an asset).

Convention-driven, so posts auto-pick up their og.webp with no frontmatter and
no publish-draft.mjs change. tsc --noEmit clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkVj9JkUhTpetCHUM52hsX
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
knowcap-landing Building Building Preview, Comment Jun 29, 2026 3:59pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Smetools, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e2e0872b-1c88-4e16-9f39-8d468feb31ce

📥 Commits

Reviewing files that changed from the base of the PR and between ce7a843 and aa389dc.

📒 Files selected for processing (2)
  • app/app/blog/[slug]/page.tsx
  • app/lib/blog.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hassan/blog-og-meta-20260629

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Smetools
Smetools merged commit 50623b3 into main Jun 29, 2026
2 of 3 checks passed
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