spinny:~/writing $ less nextjs-technical-seo.md
12Technical 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.34## 1. Dynamic Meta Tags and Open Graph56Next.js 13+ allows centralized meta tag management using the `generateMetadata` function:78```tsx9export async function generateMetadata({ params }) {10 const { locale } = await params;11 const t = await getTranslations({ locale, namespace: 'common' });12 return {13 title: t('title'),14 description: t('description'),15 openGraph: {16 title: t('title'),17 description: t('description'),18 images: ['/public/placeholder.svg'],19 },20 icons: {21 icon: '/favicon.ico',22 },23 };24}25```2627> **Tip:** Remember to update meta tags for each language and page using dynamic translations.2829## 2. Automatic Sitemap and robots.txt3031To generate sitemaps and robots.txt, use [next-sitemap](https://www.npmjs.com/package/next-sitemap):3233```bash34npm install next-sitemap35```3637Configure `next-sitemap.config.js` to support languages:3839```js40module.exports = {41 siteUrl: 'https://spinny.dev',42 generateRobotsTxt: true,43 i18n: {44 locales: [45 'it',46 'en',47 'fr',48 'de',49 'es',50 'ar',51 'hi',52 'ja',53 'zh',54 'pt',55 'bn',56 'ru',57 'id',58 'ur',59 'ko',60 'tr',61 'vi',62 'th',63 'pl',64 ],65 defaultLocale: 'it',66 },67};68```6970> **Extra Tool:** Try [next-seo](https://github.com/garmeeh/next-seo) for advanced meta tag and structured data management.7172## 3. Internationalization (i18n) and Multilingual SEO7374Next.js supports localized routes. Remember to:7576- Use the `hreflang` tag for each language.77- Generate multilingual sitemaps.78- Translate meta tags.7980Example of `hreflang` tag:8182```tsx83<link rel="alternate" href="https://spinny.dev/it" hreflang="it" />84<link rel="alternate" href="https://spinny.dev/en" hreflang="en" />85```8687> **Best Practice:** Always offer a visible language selector and maintain URL consistency.8889## 4. Performance and Core Web Vitals9091- Use Next.js `<Image />` for optimized images.92- Enable lazy loading.93- Analyze with [Lighthouse](https://developers.google.com/web/tools/lighthouse) and [Vercel Analytics](https://vercel.com/analytics).94- Minimize unused JavaScript and CSS.95- Leverage Vercel's cache and CDN.9697## 5. Structured Data (JSON-LD)9899Add structured data to improve visibility in rich snippets:100101```tsx102<script103 type="application/ld+json"104 dangerouslySetInnerHTML={{105 __html: JSON.stringify({106 '@context': 'https://schema.org',107 '@type': 'BlogPosting',108 headline: 'Technical SEO for Next.js Developers',109 datePublished: '2025-07-28',110 author: { '@type': 'Person', name: 'Filippo Spinella' },111 inLanguage: 'en',112 }),113 }}114/>115```116117> **Tip:** Also include structured data for breadcrumbs, articles, and products if applicable.118119## 6. Error Handling and Custom 404 Pages120121Create a localized `not-found.tsx` page for each language. This improves user experience and SEO.122123> **Tip:** Customize 500 and server error pages as well.124125## 7. Useful Tools126127- **next-sitemap**: sitemaps and robots.txt128- **next-seo**: advanced meta tag management129- **Google Search Console**: SEO monitoring130- **Ahrefs Webmaster Tools**: technical analysis131- **Screaming Frog**: advanced crawling132- **Mermaid**: for visualizing SEO flows and architectures133134## 8. Monitoring and Analysis135136Integrate Google Analytics, Vercel Analytics, and monitor Core Web Vitals.137138- Use [Google Tag Manager](https://tagmanager.google.com/) for centralized tag management.139- Monitor access logs and errors with tools like Sentry.140141142## Conclusion143144Technical SEO in Next.js requires attention to details like meta tags, performance, internationalization, and structured data. Automate where possible and constantly monitor results!145146> **Final Checklist:**147>148> - [x] Dynamic meta tags149> - [x] Multilingual sitemap150> - [x] Structured data151> - [x] Optimized performance152> - [x] Active monitoring153
:Technical SEO for Next.js Developers: Tips and Toolslines 1-153 (END) — press q to close