Menu

1 / 2

Your Next.js App Router pages aren't indexed? Check the canonical you didn't set

DEV Community: nextjs·Eric Gitangu·3 days ago
#Xz57b7kW
#devtonextjs#devto#dev#canonical#google
Reading 0:00
15s threshold

I relaunched my portfolio on the Next.js App Router, submitted the sitemap, and waited. A week later Google Search Console still said 0 pages indexed — everything sat in "Crawled – currently not indexed."

My first instinct was the usual: time and domain authority. Both are real for a new site. But before you blame Google, it's worth ruling out the self-inflicted version — because in my case there was one, and it's a trap that's very easy to fall into with the App Router's metadata API.

The gotcha: an inherited canonical

In the App Router you set metadata in layout.tsx or page.tsx . It's tempting to put your canonical URL once, in the root layout :

// app/layout.tsx — DON'T do this export const metadata : Metadata = { metadataBase : new URL ( " https://example.com " ), alternates : { canonical : " / " }, };

Enter fullscreen mode

Exit fullscreen mode

Metadata inherits . So every route under that layout — /about , /projects , every post — renders <link rel="canonical" href="https://example.com/"> .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.