A complete guide on how to fix SEO indexing issues in Next.js by configuring dynamic sitemaps, robots.txt, and metadata correctly for Google and Bing.
The "Discovered - currently not indexed" Problem
- •Google knows your page exists but hasn't crawled it yet.
- •Causes: Poor internal linking, duplicate content, or sitemap issues.
- •Fix: Submit a clean, valid sitemap and improve content quality.
You built a blazing fast Next.js portfolio. You deployed it. But when you check Google Search Console, you see the dreaded status: "Discovered - currently not indexed". Why? And how did I fix it for my own site?
1. The Core Issue: Static Sitemaps vs Dynamic Content
Many Next.js developers (myself included) start with a manually created `sitemap.xml`. This works for small sites, but as you add blog posts, manually updating the XML file becomes a chore. If your sitemap `lastmod` date doesn't match the actual content update, Google might ignore it.
The Solution: Next.js Metadata Route API
Instead of a static file, use `app/sitemap.js` (or `.ts`) to generate it programmatically.
import { blogData } from '../assets/assets';
export default function sitemap() {
const baseUrl = 'https://aditya-gupta.com.np';
// Blog posts dynamic generation
const blogPosts = blogData.map((blog) => ({
url: `${baseUrl}/blogs/${blog.id}`,
lastModified: new Date(blog.date),
changeFrequency: 'weekly',
priority: 0.7,
}));
return [
{
url: baseUrl,
lastModified: new Date(),
changeFrequency: 'yearly',
priority: 1,
},
...blogPosts,
];
}2. Don't Forget robots.txt
Your robot needs a map. The `robots.txt` file tells search crawlers where to find your sitemap. Without it, they are wandering blind.
export default function robots() {
return {
rules: {
userAgent: '*',
allow: '/',
disallow: '/private/',
},
sitemap: 'https://aditya-gupta.com.np/sitemap.xml',
}
}3. Optimize Your Metadata (The "Hidden" SEO)
Having a page isn't enough; it needs to look good when shared. I migrated from the old `Head` component to the new Metadata API in Next.js 14+.
❌ The Old Way (Page Router)
<Head>
<title>My Page</title>
</Head>
✅ The New Way (App Router)
export const metadata = {
title: 'My Page',
description: '...'
}
Results
After deploying these changes, I resubmitted my sitemap to Google Search Console. Within 48 hours, my "Discovered - currently not indexed" pages were moved to "Indexed", and my organic impressions started to climb.
Need Help with Next.js SEO?
Technical SEO can be tricky. I can audit your Next.js site.

