SEO & Deployment
Chapter 9
2 min read
To ensure your portfolio is discoverable and fast, we’ll implement the Next.js Metadata API and deploy via Vercel, the platform built by the creators of Next.js.
Next.js 15 uses a centralized Metadata API to manage the <head> of your pages. This is crucial for search rankings and social media previews.
A. Root Metadata (src/app/layout.tsx)
Set up a title template so your branding remains consistent across all pages.
import { Metadata } from 'next';
export const metadata: Metadata = {
metadataBase: new URL('https://yourportfolio.com'), // Required for OG images
title: {
default: 'Alex | Full Stack Developer',
template: '%s | Alex Portfolio',
},
description: 'Showcasing high-performance web applications built with Next.js.',
openGraph: {
type: 'website',
locale: 'en_US',
url: 'https://yourportfolio.com',
siteName: 'Alex Portfolio',
},
};B. Dynamic Metadata (src/app/portfolio/[slug]/page.tsx) For project pages, use generateMetadata to fetch the project’s specific title and description from your MDX frontmatter.
export async function generateMetadata({ params }): Promise<Metadata> {
const project = await getProject(params.slug);
return {
title: project.title,
description: `Case study for ${project.title}`,
};
}Vercel provides zero-config support for Next.js features like Image Optimization and Server Actions
Step-by-Step Launch: