Prefer to watch?
This article has a full video walkthrough on YouTube
Same content, live coding, 24 min — no fluff.
The components of modern SEO
SEO in 2025 goes beyond meta tags. Search engines like Google prioritize page loading performance (Core Web Vitals), mobile responsiveness, structured JSON-LD data, and semantic HTML tag hierarchy.
Configuring Metadata API
Next.js features a built-in Metadata API that automatically inserts headers for titles, descriptions, open graph cards, and canonical links. Put this export in your static or dynamic pages:
// Standard Metadata Export
export const metadata = {
title: 'Blog Post Title | Portfolio',
description: 'Learn about Next.js SEO best practices.',
openGraph: {
title: 'Blog Post Title',
description: 'Learn about Next.js SEO best practices.',
url: 'https://mysite.com/blog/seo',
images: [{ url: '/og-image.jpg' }]
}
};
Generating sitemaps and robots.txt
Instead of managing sitemaps manually, add a sitemap.js or sitemap.ts file in the app directory to dynamically fetch slugs from your database and output a valid XML sitemap at build time.