# Next.js Technical SEO Checklist for 2026: Metadata to Verification

> What to set and check for technical SEO on a Next.js App Router site: titles, canonicals, sitemaps, robots, 404s, rendering and image alt text.

Source: https://www.derar.dev/blog/nextjs-technical-seo-checklist · Published 2026-10-30 · Updated 2026-11-15 · By Derar Sattouf

Technical SEO on a Next.js App Router site is mostly about making the right answer the default. Titles, canonical URLs, sitemaps, and status codes are all computed by code, so one mistake in a shared helper can affect every page on the site. The running example is the blog on this portfolio site, and a code sample that doesn't exist in the repo yet is labeled as illustrative.

Set titles with a template, and build every canonical URL from one base URL and a path. Keep `sitemap.ts` limited to indexable URLs with accurate `lastModified` values; Google ignores `priority` and `changefreq`. Use `robots.ts` to control crawling, not indexing: to keep a page out of results, use `noindex` and leave the page crawlable.

Return a real 404 for missing content instead of redirecting missing pages to the homepage. Prerender content pages so the title, canonical, and body text are in the first HTML response. Write specific alt text, set real image dimensions, and verify each change with URL Inspection and `curl`.

For the same ideas on a multi-region storefront, with per-country metadata, hreflang tags and a sitemap per region, see my [Toothpick case study](https://www.derar.dev/work/toothpick).

## What the project already does

Read the current setup before changing anything. In this repo:

- `lib/site.ts` holds `SITE_URL` and an `absoluteUrl` helper, and the root layout sets `metadataBase` and a title template (`%s | Derar Sattouf`).
- `features/portfolio/lib/seo.ts` exports `pageMetadata`, which builds a self-referencing canonical, Open Graph and Twitter tags, optional `noindex`, and article times from one place.
- `app/(site)/blog/[slug]/page.tsx` calls it from `generateMetadata`, exports `generateStaticParams` so every post is prerendered, sets `dynamicParams = false` so unknown slugs return 404 instead of rendering on demand, and passes `updatedAt` through as the article's modified time.
- `app/sitemap.ts` composes per-section entries (each feature folder exports `sitemapEntries`); blog entries use `updatedAt` when present and fall back to `publishedAt` for `lastModified`.
- `app/robots.ts` allows `/` and `/api/og/` and blocks the rest of `/api/`, with an explicit allow list for search and AI crawlers.

That's a solid base, and it reflects fixes made after earlier versions of this post (real modified dates, no catch-all redirects, no hard-coded image sizes). It can still go wrong in places, and there's a script further down that you can run in CI to catch that.

## The metadata API

### Title templates

In the App Router, `title` can be a string or an object with `default`, `template`, and `absolute` keys. A template applies to child segments, so you define it once in the root layout and let each page supply only its own part:

```tsx
// app/layout.tsx (the project already does this)
import type { Metadata } from "next";

export const metadata: Metadata = {
  metadataBase: new URL("https://www.example.com"),
  title: {
    default: "Derar Sattouf | Full-Stack Developer",
    template: "%s | Derar Sattouf",
  },
};
```

Two details matter. `default` is required whenever you set a `template`. And a `template` defined in a `page.tsx` has no effect, because a page is always the last segment. If your post titles already include the site name, the template will duplicate it, so pick one place for the suffix.

Keep titles short enough to read in full in results. The 70-character limit in the audit script below is a practical target, not a Google rule.

### Canonical URLs

A canonical URL tells Google which address you prefer when one page is reachable through several URLs. Google documents three signals, in order of strength: redirects, `rel="canonical"` (as a link element or HTTP header), and sitemap inclusion, which is weak. Google also recommends a self-referencing canonical on the canonical page itself, not only on its duplicates.

In this project, `pageMetadata` takes a `path` and sets `alternates.canonical` to it, so query strings such as `?utm_source=...` never reach the canonical. Keep that property when you extend the code. The `alternates.canonical` field in the Metadata object renders the `<link rel="canonical">` tag, and a relative value resolves against `metadataBase`.

Canonical values must be absolute and consistent. The canonical, the sitemap entry, and internal links should all use the same form, whether that is `www` or the bare domain, and with or without a trailing slash. Mixed signals leave Google to choose for you.

### Open Graph and Twitter cards

Open Graph and Twitter tags mainly control how a shared link looks. They should still be correct, because the title and description often reach search results and social previews from the same source.

`pageMetadata` sets `openGraph` and `twitter` with `summary_large_image` and keeps them in sync with the title and description. Two details to check:

- Declared image sizes must match the real file. A helper that hard-codes one width and height for every image declares the wrong size for any image with different dimensions. Read real dimensions or pass them in.
- `publishedTime` and `modifiedTime` should come from real content dates. This project passes `updatedAt` as the modified time when a post has one. Bump `updatedAt` only for substantive edits, and keep it consistent with the JSON-LD `dateModified` and the sitemap `lastModified`.

## sitemap.ts and robots.ts

### sitemap.ts

The sitemap is a discovery aid. It does not force indexing, but it helps Google find URLs and, when its dates are accurate, decide what to recrawl. Three rules from Google's guidance affect this file:

- Google ignores `<priority>` and `<changefreq>`. Leave them out of new work.
- Google uses `<lastmod>` only when it is consistently and verifiably accurate. Update it for substantive changes to main content, structured data, or links, not for trivial edits.
- A single sitemap file is limited to 50,000 URLs or 50 MB uncompressed. Larger sites need a sitemap index or `generateSitemaps`.

The repo's version already uses the right pattern: each post's `lastModified` is its `updatedAt` when present and `publishedAt` otherwise, and index pages take the date of their newest entry, so dates move only when content moves. It still sets `changeFrequency` and `priority`, which Google ignores. They are harmless, but you can drop them. The core of the logic is small:

```ts
// features/portfolio/sitemap.ts (excerpt, simplified)
const modifiedAt = (post: Post) =>
  new Date(post.metadata.updatedAt || post.metadata.publishedAt);

const posts = getPosts("blog").map((post) => ({
  url: absoluteUrl(`/blog/${post.slug}`),
  lastModified: modifiedAt(post),
}));
```

`MetadataRoute.Sitemap` allows `lastModified` to be omitted. For static pages with no real change date, omitting it is more honest than stamping today's date on them.

The sitemap should also list only URLs that return 200 and are indexable. A sitemap that includes redirected or `noindex` URLs sends mixed signals.

### robots.ts

`robots.txt` controls crawling. It does not control indexing, and it does not remove URLs that are already indexed. The repo's file allows everything and points to the sitemap, which is the right default for a portfolio. The main risk is adding a `disallow` rule to hide a page you want removed from results. Google must be able to crawl a page to read its `noindex` rule, so blocking it in `robots.txt` can stop the directive from being read.

Keep rules narrow. A rule like `disallow: "/api/"` would also block `/api/og/generate`, which the blog uses as a fallback Open Graph image. Block only paths that should never be crawled.

```ts
// app/robots.ts (shape of the project's file, simplified)
import type { MetadataRoute } from "next";
import { absoluteUrl } from "@/lib/site";

export default function robots(): MetadataRoute.Robots {
  return {
    rules: [
      { userAgent: "*", allow: ["/", "/api/og/"], disallow: ["/api/"] },
    ],
    sitemap: absoluteUrl("/sitemap.xml"),
    host: absoluteUrl("/"),
  };
}
```

The `allow` for `/api/og/` before the broader `disallow: ["/api/"]` keeps generated Open Graph images fetchable while the rest of the API stays out of the crawl.

## Indexability: noindex, redirects, and status codes

### noindex

Use a robots meta tag to keep a page out of results. The Metadata API renders it from the `robots` field. Use it for pages with no search value, such as a form confirmation page:

```tsx
// app/thanks/page.tsx (illustrative)
import type { Metadata } from "next";

export const metadata: Metadata = {
  robots: { index: false, follow: true },
};
```

For non-HTML files such as PDFs, Google recommends the `X-Robots-Tag` HTTP header, because those files cannot carry a meta tag.

### Redirects

Use a permanent redirect when a URL has moved for good. Google treats a redirect as a strong canonical signal, so the target becomes the URL Google indexes. Keep redirect chains short, since each extra hop is another request for crawlers to follow. Map old blog slugs to new ones in `next.config` or middleware, and remove the old URL from the sitemap.

### 404 vs soft 404

A missing page should return HTTP 404. For removed content, Google treats 404 and 410 the same way, and its HTTP status documentation says all 4xx errors except 429 are handled alike.

A soft 404 is a page that returns a success status while showing "not found" content. Google's 404 help page describes redirecting missing pages to the homepage, instead of returning a 404, as problematic and confusing for users and search engines. Do not use the homepage as a catch-all for unknown blog slugs.

In this project, the blog route calls `notFound()` when a slug does not match a post. `generateMetadata` returns an empty object in that case, and the page then calls `notFound()`. The route also sets `dynamicParams = false`, so slugs that were not prerendered return 404 without being rendered on demand (the default, `true`, would render unknown slugs on demand, which then rely on `notFound()` to produce the 404). Verify the behavior with `curl` (see the curl checks below) rather than assuming it.

## Dynamic routes and canonical handling

Dynamic routes create most of the duplicate-URL problems. A route at `/blog/[slug]` is clean because each slug maps to one post. Filtered and paginated lists are not clean. `/blog?tag=react`, `/blog?tag=react&page=2`, and `/blog?utm_source=newsletter` can all show near-identical content.

For those pages, decide the canonical explicitly. A common pattern is to point filtered variants at the unfiltered list. Paginated pages usually should keep a self-referencing canonical, because page two does not contain the same items as page one. The helper makes the first choice simple:

```tsx
// app/(site)/blog/page.tsx (illustrative)
import type { Metadata } from "next";
import { pageMetadata } from "@/features/portfolio/lib/seo";

export const metadata: Metadata = pageMetadata({
  title: "Blog | Derar Sattouf",
  description: "Notes on Next.js, AI tooling, and developer workflows.",
  path: "/blog",
});
```

Because the canonical is set from `path` alone, every query-string variant points to the same canonical. The response body is still rendered for each variant, so if you have many filter combinations, consider `noindex` on the filtered variants, or stop linking to them.

Also check slug collisions and trailing-slash variants. `/blog/post` and `/blog/post/` should resolve to one URL through a redirect or a consistent configuration, not to two live pages.

## Rendering choices and crawlers

Googlebot indexes rendered HTML, but rendering is a separate, deferred step. Google's JavaScript documentation says pages are queued for rendering, the queue can last longer than a few seconds, and a headless Chromium executes the JavaScript afterward. Pages whose HTML already contains the content are simpler for Google and for every bot that does not run JavaScript.

Next.js offers three practical options for content pages:

- **Static, prerendered at build.** The HTML contains the title, canonical, and body. This is the best default for blog posts, and the `generateStaticParams` export in the blog route does it for every post.
- **ISR, static with revalidation.** Set `export const revalidate = 3600` on a route. Next.js serves the cached page and regenerates it in the background after the interval. A visitor after expiry gets the stale page immediately, and later requests get the fresh version. ISR suits content that changes occasionally, such as a post index or a case-study list.
- **Dynamic, rendered per request.** Use it when the page depends on request data such as cookies or headers. It costs the most per request, so keep it off content pages that do not need it.

For crawlers, the question is whether the content and metadata are in the first response. Next.js resolves `generateMetadata` as part of rendering, and streaming can change when metadata reaches the response. Static HTML is still the easiest case to verify, and it helps every bot that does not render JavaScript.

Two crawler-specific points follow. Google's documentation says non-200 responses may skip rendering, so JavaScript on an error page will not rescue it. And Google warns that JavaScript which changes or removes a `noindex` tag may not behave reliably, so set `noindex` on the server.

## Image SEO with next/image

Google calls alt text the most important image metadata. Write a short, specific description of what the image shows in the context of the page, and do not stuff keywords into it. A decorative image can use an empty `alt=""`.

Google also recommends placing images near the text that describes them, using common formats (BMP, GIF, JPEG, PNG, WebP, SVG, and AVIF), and making the filename extension match the actual file type. For images that Google might otherwise miss, such as those served from a CDN, an image sitemap helps.

The `next/image` component handles much of the performance work, but you still supply the semantics:

```tsx
import Image from "next/image";

export function PostHero({ title, src }: { title: string; src: string }) {
  return (
    <Image
      src={src}
      alt={`Diagram from the post "${title}"`}
      width={1408}
      height={768}
      priority
    />
  );
}
```

The `width` and `height` props must match the real file, which is the same warning as for Open Graph dimensions. They let the browser reserve space before the image loads, which prevents layout shift. Use `priority` only for the image visible above the fold, typically the post hero, since it asks the browser to load that image early. Leave other images on the default lazy loading.

Alt text should describe what the image adds to the article. A generic description of a stock photo adds nothing for readers or for search.

## Verification workflow

Verification has two halves: what Google sees, and what your server returns. Use both.

### Search Console URL Inspection

The URL Inspection tool shows Google's indexed version of a page, including indexing status, canonical details, and structured data findings. Those results come from the last indexed version. After a fix, run Test live URL to fetch the current page, and check the rendered screenshot.

Google's documentation has two cautions. A passing live test does not guarantee indexing, and the live test does not check manual actions, quality issues, or which canonical Google will choose. Request indexing only after the live test is clean, and keep the daily limits on inspections and indexing requests in mind. Indexing can take days or longer after a fix, so re-check the status over time rather than expecting an immediate change.

### Structured data validation

The blog route already renders `BlogPosting` JSON-LD through a `JsonLd` component. To check the output, run the page through Google's Rich Results Test and the Schema Markup Validator, and watch the enhancement reports in Search Console. Tool behavior changes, so confirm in Search Central what each tool currently checks.

### curl checks

Browsers hide what crawlers receive, because they run JavaScript and follow redirects silently. Check the raw response with `curl`. These commands use the project's fallback domain as an illustration:

```bash
# Status code, redirect target, and cache header for a live post
curl -sI https://www.derar.dev/blog/nextjs-technical-seo-checklist-2026 \
  | grep -iE '^(HTTP|x-robots-tag|x-nextjs-cache|location)'

# Status code for a missing slug. Expect 404, not 200.
curl -s -o /dev/null -w "%{http_code}\n" https://www.derar.dev/blog/does-not-exist

# Canonical tag in the initial HTML, without a browser
curl -s https://www.derar.dev/blog/nextjs-technical-seo-checklist-2026 \
  | grep -o '<link rel="canonical"[^>]*>'

# Robots and sitemap as crawlers see them
curl -s https://www.derar.dev/robots.txt
curl -s https://www.derar.dev/sitemap.xml | head -c 500
```

Read the output against a few expectations. The post should return 200 with a canonical that matches its own URL. The missing slug should return 404. For ISR routes, the `x-nextjs-cache` header shows `HIT`, `STALE`, `MISS`, or `REVALIDATED`, which confirms whether revalidation is working. Next.js documents those values.

## Next.js 16 Details That Affect SEO

A few framework behaviors are worth knowing because they change what crawlers receive.

**Streaming metadata and bots.** Since Next.js 15.2, metadata from `generateMetadata` can be streamed after the initial UI is sent, which can improve time to first byte. Next.js detects "HTML-limited bots" from the user agent and, for those, delays sending the response until metadata resolves so the tags are in the initial HTML. The list of user agents is overridable with the `htmlLimitedBots` option in `next.config`. Google renders JavaScript, so streamed metadata is fine for Googlebot; the HTML-limited-bot path exists for crawlers that read only the first response. Do not override `htmlLimitedBots` unless you have a measured reason, since the docs note it can lengthen response times.

**Static metadata when possible.** If a page's metadata does not depend on request data, a static `metadata` export (or `generateMetadata` on a prerendered route) puts everything in the first response. Prerendered blog posts are the simplest case and the easiest to verify.

**Request interception is now called Proxy.** In current Next.js, the file convention formerly known as middleware is named `proxy`. For SEO the rule is unchanged: keep redirect logic fast, avoid redirect chains, and make sure it does not rewrite crawlers into different content than users see.

**Permanent redirects use 308.** In `next.config`, `redirects` with `permanent: true` respond with status 308 (and `false` gives 307). Google treats 301 and 308 as permanent redirects, so this is fine for moved URLs.

```ts
// next.config.ts
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  async redirects() {
    return [
      // old slug -> new slug, one hop
      { source: "/blog/old-post-title", destination: "/blog/new-post-title", permanent: true },
      // retired section -> closest equivalent, not the homepage
      { source: "/articles/:slug", destination: "/blog/:slug", permanent: true },
    ];
  },
};

export default nextConfig;
```

**Cache Components and dynamic data.** With the newer caching model, content pages that read request-time data (cookies, headers) become dynamic. Keep content pages free of request-time reads, or isolate them in small components so the main content stays prerenderable.

**Verify against your installed version.** The Next.js docs ship inside the package at `node_modules/next/dist/docs`, which is a reliable place to check behavior for the exact version you run.

## Structured Data That Is Safe To Ship

Structured data should describe what is visible on the page. The Next.js guide recommends rendering JSON-LD as a script tag in a layout or page, and warns that `JSON.stringify` does not sanitize strings. Escape `<` as `<` so content can never close the script tag:

```tsx
// components/json-ld.tsx
export function JsonLd({ data }: { data: Record<string, unknown> }) {
  return (
    <script
      type="application/ld+json"
      dangerouslySetInnerHTML={{
        __html: JSON.stringify(data).replace(/</g, "\\u003c"),
      }}
    />
  );
}
```

A breadcrumb trail that mirrors the visible breadcrumbs:

```tsx
const breadcrumb = {
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  itemListElement: [
    { "@type": "ListItem", position: 1, name: "Home", item: "https://www.example.com/" },
    { "@type": "ListItem", position: 2, name: "Blog", item: "https://www.example.com/blog" },
    { "@type": "ListItem", position: 3, name: post.title, item: `https://www.example.com/blog/${post.slug}` },
  ],
};
```

Rules: only mark up content users can see, keep dates consistent with the page, validate with the Rich Results Test and the Schema Markup Validator, and do not add markup types just to look complete. Note that FAQ rich results were discontinued in Google Search in 2026. Details and a type-by-type guide are in [Structured Data and JSON-LD: A Developer's SEO Guide](https://www.derar.dev/blog/structured-data-json-ld-seo-guide).

## Lab: A CI Script That Audits Your Whole Sitemap

Manual checks do not scale. This script reads your sitemap and verifies the basics for every URL: status, canonical, title length, `noindex`, H1 count and Open Graph image. It needs Node 20 or newer and no dependencies.

```js
// scripts/seo-audit.mjs
// Usage: node scripts/seo-audit.mjs https://www.example.com
const origin = (process.argv[2] ?? "http://localhost:3000").replace(/\/$/, "");

const get = async (url) => {
  const res = await fetch(url, { redirect: "manual", headers: { "user-agent": "seo-audit/1.0" } });
  return { status: res.status, location: res.headers.get("location"), xrobots: res.headers.get("x-robots-tag"), body: await res.text() };
};

const sitemap = await get(`${origin}/sitemap.xml`);
const urls = [...sitemap.body.matchAll(/<loc>([^<]+)<\/loc>/g)].map((m) => m[1].trim());
console.log(`Found ${urls.length} URLs in sitemap`);

const attr = (html, re) => html.match(re)?.[1];
const problems = [];

const check = async (url) => {
  const local = url.replace(/^https?:\/\/[^/]+/, origin); // audit a local server using prod URLs
  const r = await get(local);
  const add = (msg) => problems.push(`${url}: ${msg}`);

  if (r.status !== 200) return add(`status ${r.status}${r.location ? " -> " + r.location : ""}`);
  const title = attr(r.body, /<title[^>]*>([^<]*)<\/title>/i);
  const canonical = attr(r.body, /<link[^>]+rel="canonical"[^>]+href="([^"]+)"/i);
  const robots = attr(r.body, /<meta[^>]+name="robots"[^>]+content="([^"]+)"/i) ?? "";
  const h1s = (r.body.match(/<h1[\s>]/gi) ?? []).length;
  const ogImage = attr(r.body, /<meta[^>]+property="og:image"[^>]+content="([^"]+)"/i);

  if (!title) add("missing title");
  else if (title.length > 70) add(`title is ${title.length} chars`);
  if (!canonical) add("missing canonical");
  else if (canonical.replace(/\/$/, "") !== url.replace(/\/$/, "")) add(`canonical mismatch: ${canonical}`);
  if (/noindex/i.test(robots) || /noindex/i.test(r.xrobots ?? "")) add("noindex on a sitemap URL");
  if (h1s !== 1) add(`${h1s} h1 elements`);
  if (!ogImage) add("missing og:image");
};

// Small concurrency pool
const queue = [...urls];
await Promise.all(Array.from({ length: 6 }, async () => {
  while (queue.length) await check(queue.shift());
}));

// Missing page must be a real 404
const missing = await get(`${origin}/definitely-not-a-real-page-${Date.now()}`);
if (missing.status !== 404) problems.push(`unknown URL returned ${missing.status}, expected 404`);

if (problems.length) {
  console.error(problems.join("\n"));
  process.exit(1);
}
console.log("SEO audit passed");
```

Add it to CI after a production build:

```yaml
- run: npm run build
- run: npm run start &
- run: npx wait-on http://localhost:3000
- run: node scripts/seo-audit.mjs http://localhost:3000
```

This catches the regressions that hurt most: a template change that drops canonicals, a `noindex` left from staging, or a catch-all that turns 404s into 200s. Regex checks are intentionally simple; for stricter parsing use an HTML parser library.

## Lists, Pagination And Filters

Listing pages are where duplicate and thin URLs breed. Apply these rules:

| Page type | Canonical | Indexing | Notes |
| --- | --- | --- | --- |
| `/blog` | itself | index | Link to each post with descriptive anchors |
| `/blog?page=2` or `/blog/page/2` | itself | index | Different items than page 1, so self-canonical. Use real links, not only a "load more" button |
| `/blog?tag=react` (filter) | the unfiltered list, or itself if the filter has standalone value | usually `noindex, follow` for combinations | Avoid indexing every filter combination |
| `/blog?sort=newest` | `/blog` | `noindex` or ignore | Sorting adds no new content |
| Internal search results | none | `noindex` | Low value for search engines |

Because `searchParams` makes a page dynamic, prefer path-based pagination for content you want prerendered, and set `robots: { index: false, follow: true }` in `generateMetadata` for filter variants:

```tsx
export async function generateMetadata({ searchParams }: { searchParams: Promise<{ tag?: string; sort?: string }> }): Promise<Metadata> {
  const { tag, sort } = await searchParams;
  const isFilteredView = Boolean(tag || sort);
  return {
    alternates: { canonical: "/blog" },
    robots: isFilteredView ? { index: false, follow: true } : undefined,
  };
}
```

Google no longer uses `rel="next"` and `rel="prev"` as an indexing signal, so rely on crawlable links and sensible canonicals instead.

## International And Alternate URLs

If you publish in several languages, use `alternates.languages` so each version declares its siblings. Every language version must list all the others and itself, and the references must be reciprocal:

```tsx
export const metadata: Metadata = {
  alternates: {
    canonical: "/en/blog/my-post",
    languages: {
      "en": "/en/blog/my-post",
      "de": "/de/blog/my-post",
      "x-default": "/en/blog/my-post",
    },
  },
};
```

Use real translations. Auto-translated pages with no review tend to land in "Crawled - currently not indexed". See the Next.js internationalization guide for routing patterns.

## Reading The Search Console Page Indexing Report

The report groups URLs by status. What each common status usually means for a Next.js site, and the first thing to check:

| Status | Usually means | First action |
| --- | --- | --- |
| Crawled - currently not indexed | Google fetched the page and decided not to index it yet. Often thin, duplicated or low value | Improve substance (examples, original detail, sources), add internal links from strong pages, then wait. Do not resubmit repeatedly |
| Discovered - currently not indexed | Known URL not crawled yet, often due to perceived low priority or crawl load | Improve internal linking and site quality; confirm the server is fast and healthy |
| Duplicate without user-selected canonical | Google picked its own canonical | Add a clear self-canonical; consolidate duplicates with redirects |
| Duplicate, Google chose different canonical than user | Your canonical disagrees with other signals | Align redirects, internal links, sitemap and canonical; check content similarity |
| Alternate page with proper canonical tag | Working as intended for variants | Nothing, if the canonical target is indexed |
| Soft 404 | Page returns 200 but reads as empty or not found | Return a real 404, or add real content |
| Page with redirect | URL redirects elsewhere | Remove it from the sitemap and update internal links |
| Blocked by robots.txt | Crawling prohibited | Confirm that is intended; remember `noindex` cannot be read on blocked pages |
| Excluded by noindex tag | Intentional or left over | Remove if unintended; check headers and templates |
| Server error (5xx) | Failures when Google fetched | Check logs, timeouts and cold starts |

"Crawled - currently not indexed" is the one that signals content quality more than technical errors. Fixing metadata will not help a page that Google considers thin. Add depth, original examples and clear structure, then link to it from related pages. Our guides on [Keyword Research and Internal Linking](https://www.derar.dev/blog/keyword-research-internal-linking-seo) and [SEO for Google AI Mode](https://www.derar.dev/blog/google-ai-mode-seo) cover the content side.

## Performance Touches That Help Crawling And Users

Technical SEO overlaps with performance. Cheap wins in Next.js:

- Use `next/image` with real `width` and `height`, `priority` only on the LCP image, and `sizes` that match your layout.
- Use `next/font` to avoid layout shift from font swapping.
- Keep third-party scripts out of the critical path with `next/script` strategies.
- Avoid large client components on content pages. Prefer server components for text-heavy pages, and ship only interactive islands as client code.
- Keep TTFB low: prerender or cache what can be prerendered or cached.

Measure with Lighthouse for diagnosis and with real-user data for truth. See [Core Web Vitals and INP in Next.js](https://www.derar.dev/blog/core-web-vitals-inp-nextjs-guide) and [Speculation Rules for Instant Navigation](https://www.derar.dev/blog/speculation-rules-instant-navigation).

## Troubleshooting Table

| Symptom | Likely cause | Fix |
| --- | --- | --- |
| Canonical shows `localhost` or a preview URL | `metadataBase` or the site URL env var is wrong in that environment | Set the site URL per environment; assert it in the audit script |
| Page indexed with a `?utm=` URL | Canonical missing or built from the full URL | Build the canonical from the path only |
| Unknown URLs return 200 | Catch-all route or `not-found` rendered with wrong status | Call `notFound()`; test with `curl -I` |
| Sitemap lists redirected URLs | Slug changed but sitemap source is stale | Generate the sitemap from the same data as the routes |
| `lastModified` changes every deploy | `new Date()` in the sitemap | Use real content dates |
| Titles show the site name twice | Template plus a title that already includes the name | Use `title: { absolute }` or remove the suffix from page titles |
| Old URLs still rank after a move | Missing or chained redirects | Add one-hop permanent redirects; update internal links |
| `noindex` pages still indexed | Blocked by robots.txt so the tag was never read | Allow crawling; keep `noindex`; wait for recrawl |
| OG image missing in previews | Wrong absolute URL, blocked by robots, or wrong size | Fix the URL; allow the image route in robots |
| Different title in the browser and in the HTML source | Client-side code changes the title | Set the title via the Metadata API on the server |
| Search Console says "Submitted URL not found (404)" | Sitemap lists removed pages | Rebuild the sitemap; redirect or remove |

## When to leave it alone

If a page sits behind a login, authenticated app screens should be `noindex` or blocked at the edge. Spend the time on the public marketing pages. If pages are thin, fix the content first, because technical polish can't turn thin pages into useful ones. A 62-character versus 58-character title isn't worth a sprint, so fix structural errors first.

If your traffic isn't search-driven (a product sold by outbound sales, say), a lean set of correct pages is enough. And when a plugin or helper already does the right thing, don't duplicate canonical or robots logic in several places.

## Step-by-step checklist

1. Set a root `title` template with a `default`, and keep page titles short.
2. Build every canonical URL from one base URL and a path, without query strings.
3. Confirm each indexable page has a self-referencing canonical in its initial HTML.
4. Remove `priority` and `changefreq` from `sitemap.ts`, and set `lastModified` only from real content dates.
5. Include only indexable URLs that return 200 in the sitemap.
6. Keep `robots.ts` narrow, and never disallow a page you want removed from results.
7. Use `noindex` on pages that should not appear in results, and keep those pages crawlable.
8. Return 404 for missing content, and replace homepage redirects with real 404 responses.
9. Use permanent redirects for moved URLs, and keep chains to one hop.
10. Prerender content pages with `generateStaticParams`, and use ISR for content that changes slowly.
11. Write specific alt text, set real width and height, and use `priority` only on the above-the-fold image.
12. Verify each change with URL Inspection, Test live URL, and the `curl` checks above.

## Where this usually goes wrong

- Stamping `lastModified` with `new Date()`. Every build changes the date on pages that did not change, so the signal becomes noise.
- Keeping ignored sitemap fields. `priority` and `changefreq` do nothing for Google. They are harmless, but they suggest the file was not reviewed.
- Blocking a `noindex` page in robots.txt. The directive is never read, so the page can stay indexed.
- Catch-all redirects. Sending every unknown slug to `/` produces soft 404s and hides broken links.
- Hard-coded metadata dimensions. A helper that always declares one width and height is wrong for any image with a different size.
- Canonicals that disagree with the sitemap. If the canonical uses `www` and the sitemap uses the bare domain, Google has to guess.
- Metadata that appears only after JavaScript runs. Titles or body text that depend on client-side code rely on the deferred rendering queue.
- Testing only in a browser. A browser runs JavaScript and hides the status code. Use `curl` to see what the server returns.

## Questions that come up

**Should I add a trailing slash, and do I need `www`?** Pick one form of each and apply it everywhere: canonical, sitemap and internal links. Next.js has a `trailingSlash` option; whichever you choose, redirect the other form. Either `www` or non-`www` works. Redirect one to the other with a permanent redirect and use that host in canonicals and the sitemap.

**How big can one sitemap be?** Up to 50,000 URLs or 50 MB uncompressed. Use `generateSitemaps` to split larger sets.

**Should AI crawlers be allowed in robots.txt?** That is a business decision. Allowing them can make your content available to AI search products; blocking them reduces that. Google's own AI features use Googlebot, and the `Google-Extended` token is a separate opt-out for training and grounding in other Google products. See [Generative Engine Optimization](https://www.derar.dev/blog/generative-engine-optimization-geo) and [SEO for Google AI Mode](https://www.derar.dev/blog/google-ai-mode-seo).

**Is ISR better than static generation for SEO?** Neither is better for crawlers by itself, since both serve prerendered HTML. ISR lets you update content without a full rebuild, at the cost of one stale response after each interval.

**How do I confirm Google picked up a fix?** Run URL Inspection on the page, then Test live URL, and check the indexing status. Indexing is not guaranteed, and the live test does not show which canonical Google will choose.

**How often should I run the audit?** On every pull request that touches routing, metadata or content, and weekly on production.

## Links worth keeping

- [Next.js: generateMetadata and the Metadata API](https://nextjs.org/docs/app/api-reference/functions/generate-metadata)
- [Next.js: JSON-LD guide](https://nextjs.org/docs/app/guides/json-ld)
- [Next.js: sitemap.xml and generateSitemaps](https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap)
- [Next.js: redirects in next.config](https://nextjs.org/docs/app/api-reference/config/next-config-js/redirects)
- [Google: Page indexing report](https://support.google.com/webmasters/answer/7440203)
- [Google: Search Essentials](https://developers.google.com/search/docs/essentials)
- [Google: Localized versions of your pages](https://developers.google.com/search/docs/specialty/international/localized-versions)
- Related on this site: [Next.js Server Components, Caching and Data Patterns](https://www.derar.dev/blog/nextjs-server-components-caching-data-patterns), [Next.js Security Upgrades Checklist](https://www.derar.dev/blog/nextjs-upgrade-security-checklist).

## Sources

- Google Search Central, HTTP status codes and network errors: https://developers.google.com/search/docs/crawling-indexing/http-network-errors
- Google Search Help, 404 (Page Not Found) errors: https://support.google.com/webmasters/answer/2445990?hl=en
- Google Search Central, Consolidate duplicate URLs: https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls
- Google Search Central, Build and submit a sitemap: https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap
- Google Search Central, Google Images best practices: https://developers.google.com/search/docs/appearance/google-images
- Google Search Help, URL Inspection tool: https://support.google.com/webmasters/answer/9012289
- Google Search Central, JavaScript SEO basics: https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics
- Google Search Central, Robots meta tag and X-Robots-Tag: https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag
- Next.js docs, generateMetadata: https://nextjs.org/docs/app/api-reference/functions/generate-metadata
- Next.js docs, sitemap.xml file convention: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap
- Next.js docs, Incremental Static Regeneration: https://nextjs.org/docs/app/guides/incremental-static-regeneration
