Technical SEO is essential to ensure your Next.js site is easily indexable, fast, and competitive in search results. This guide covers strategies, tools, and practical snippets to take your SEO to the next level, with a special focus on multilingual sites.
1. Dynamic Meta Tags and Open Graph
Next.js 13+ allows centralized meta tag management using the generateMetadata
function:
export async function generateMetadata({ params }) { const { locale } = await params; const t = await getTranslations({ locale, namespace: 'common' }); return { title: t('title'), description: t('description'), openGraph: { title: t('title'), description: t('description'), images: ['/public/placeholder.svg'], }, icons: { icon: '/favicon.ico', }, }; }
Tip: Remember to update meta tags for each language and page using dynamic translations.
2. Automatic Sitemap and robots.txt
To generate sitemaps and robots.txt, use next-sitemap:
npm install next-sitemap
Configure next-sitemap.config.js
to support languages:
module.exports = { siteUrl: 'https://spinny.dev', generateRobotsTxt: true, i18n: { locales: ['it', 'en', 'fr', 'de', 'es', 'ar', 'hi', 'ja', 'zh'], defaultLocale: 'it', }, };
Extra Tool: Try next-seo for advanced meta tag and structured data management.
3. Internationalization (i18n) and Multilingual SEO
Next.js supports localized routes. Remember to:
- Use the
hreflang
tag for each language. - Generate multilingual sitemaps.
- Translate meta tags.
Example of hreflang
tag:
<link rel="alternate" href="https://spinny.dev/it" hreflang="it" /> <link rel="alternate" href="https://spinny.dev/en" hreflang="en" />
Best Practice: Always offer a visible language selector and maintain URL consistency.
4. Performance and Core Web Vitals
- Use Next.js
<Image />
for optimized images. - Enable lazy loading.
- Analyze with Lighthouse and Vercel Analytics.
- Minimize unused JavaScript and CSS.
- Leverage Vercel's cache and CDN.
5. Structured Data (JSON-LD)
Add structured data to improve visibility in rich snippets:
<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify({ '@context': 'https://schema.org', '@type': 'BlogPosting', headline: 'Technical SEO for Next.js Developers', datePublished: '2025-07-28', author: { '@type': 'Person', name: 'Filippo Spinella' }, inLanguage: 'en', }), }} />
Tip: Also include structured data for breadcrumbs, articles, and products if applicable.
6. Error Handling and Custom 404 Pages
Create a localized not-found.tsx
page for each language. This improves user experience and SEO.
Tip: Customize 500 and server error pages as well.
7. Useful Tools
- next-sitemap: sitemaps and robots.txt
- next-seo: advanced meta tag management
- Google Search Console: SEO monitoring
- Ahrefs Webmaster Tools: technical analysis
- Screaming Frog: advanced crawling
- Mermaid: for visualizing SEO flows and architectures
8. Monitoring and Analysis
Integrate Google Analytics, Vercel Analytics, and monitor Core Web Vitals.
- Use Google Tag Manager for centralized tag management.
- Monitor access logs and errors with tools like Sentry.
Conclusion
Technical SEO in Next.js requires attention to details like meta tags, performance, internationalization, and structured data. Automate where possible and constantly monitor results!
Final Checklist:
- [x] Dynamic meta tags
- [x] Multilingual sitemap
- [x] Structured data
- [x] Optimized performance
- [x] Active monitoring