opengraph-images

Generate dynamic OpenGraph images with Next.js ImageResponse and custom fonts.

21|2|Updated Nov 5, 2023
One-click install
npx skills add https://github.com/sgcarstrends/sgcarstrends --skill opengraph-images
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: opengraph-images
Source: https://github.com/sgcarstrends/sgcarstrends/tree/main/.claude/skills/opengraph-images
Command: npx skills add https://github.com/sgcarstrends/sgcarstrends --skill opengraph-images

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps build dynamic OpenGraph images using Next.js ImageResponse to improve social sharing previews.

Core Features & Use Cases

  • Dynamic OG images per page (blog, about, etc.).
  • Font integration for branded typography.
  • Standard OG config with alt text and size.

Quick Start

Add an opengraph image for a blog post path and reference it in the page metadata.

Frequently Asked Questions about opengraph-images

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create dynamic OpenGraph images for Next.js pages?

Dynamic OpenGraph images in Next.js use the ImageResponse API to generate social preview graphics on demand. Create a route handler that returns an image response with custom layouts, fonts, and page-specific content, then reference it in your page metadata as the og:image property.

Can I use custom fonts in OpenGraph images?

Yes, custom fonts work in OpenGraph images by loading font files from your assets/fonts directory. Pass the font data to ImageResponse with the font family name and weight, enabling branded typography in your social previews.

How do I generate page-specific OG images with dynamic routes in Next.js?

Use dynamic route segments in your image route handler to capture page identifiers and generate unique OG images per page. Extract the parameter, fetch or compute the page content, and return a customized ImageResponse for each route.

What metadata do I need to export with OpenGraph images?

Standard OG image exports include alt text for accessibility, size dimensions (width and height), and contentType (typically image/png). These properties ensure proper rendering and fallback behavior across social platforms.

When should I use dynamic OG images instead of static images?

Use dynamic OG images when content changes frequently—blog posts, product pages, user profiles—or when you need to personalize social previews. Static images work only for fixed content; dynamic generation scales to unlimited pages without manual asset creation.