Developer fixes Next.js indexing failure with four lines of metadata code
A developer discovered that Google Search Console was treating their Next.js pages as blank despite the site functioning normally for users. The root cause was a static metadata object in layout.tsx that gave every page identical titles and descriptions, which Google flagged as duplicate content. Switching to Next.js App Router's generateMetadata function allowed unique, data-driven titles, descriptions, and Open Graph tags to be generated per route at the server level. The developer also automated sitemap.xml and robots.txt generation using TypeScript files that rebuild with each deployment, keeping them in sync with live content. The findings highlight that most Next.js SEO problems stem from missing or misconfigured metadata plumbing rather than search algorithm issues.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in