Dynamic Social Previews & Launch
Chapter 12
2 min read
To ensure your portfolio looks professional when shared on LinkedIn or X (Twitter), we will use the Next.js ImageResponse API. This allows you to programmatically generate Open Graph (OG) images using JSX and CSS.
Instead of manually creating images for every project, Next.js can generate them on the fly using a special file convention: opengraph-image.tsx.
Implementation (app/portfolio/[slug]/opengraph-image.tsx):
import { ImageResponse } from 'next/og';
export const runtime = 'edge'; // Use Edge for speed
export const alt = 'Project Preview';
export const size = { width: 1200, height: 630 }; // Recommended size
export default async function Image({ params }: { params: { slug: string } }) {
// Fetch project data for the dynamic title
const { slug } = params;
return new ImageResponse(
(
<div
style={{
height: '100%',
width: '100%',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#0a0a0a', // Matches our $background-dark
backgroundImage: 'radial-gradient(circle at 25% 25%, #e63946 0%, transparent 20%)',
}}
>
<div style={{ color: 'white', fontSize: 64, fontWeight: 'bold' }}>
{slug.replace(/-/g, ' ')}
</div>
<div style={{ color: '#e63946', fontSize: 32, marginTop: 20 }}>
Case Study | Alex Portfolio
</div>
</div>
),
{ ...size }
);
}Before hitting "Deploy" on Vercel, run through this high-performance checklist to ensure your site is job-market ready:
You have built a modern, MDX-powered portfolio using SCSS Modules, Framer Motion, and Server Actions. This stack is highly optimized for the 2026 web, focusing on minimal client-side JavaScript and maximum SEO visibility.
Congratulations! Your portfolio is officially complete