> For AI agents: the complete documentation index is available at https://nhanbe.id.vn/llms.txt, the full documentation bundle is available at https://nhanbe.id.vn/llms-full.txt.

# Google Search Console: Page Indexing Report & Debugging Playbook

For software engineers and technical SEO practitioners, **Google Search Console (GSC)** is far more than a keyword tracker—it is the primary diagnostic telemetry dashboard showing how Google's infrastructure interacts with your site architecture. Unlike third-party crawlers (such as Screaming Frog or Ahrefs) or `site:` search operators that can only simulate crawls from the outside, the **Page Indexing report** exposes Google's **first-party internal state** across its crawl queue, Web Rendering Service (WRS), and canonical clustering pipeline.

This guide breaks down the architecture behind the Page Indexing report, explains how to interpret its metrics accurately, and provides code- and infrastructure-level fixes for every **Not indexed** status defined in Google Search Central documentation.

***

## 1. Pipeline Architecture: From URL to the Google Index

To understand why a URL lands in a **Not indexed** bucket, trace the four-stage pipeline every URL must pass through inside Google's indexing infrastructure:

```mermaid
flowchart LR
    D["01 Discovery<br/>sitemap.xml, links, redirects, URL Inspection"] --> C["02 Crawling (Googlebot)<br/>robots.txt, crawl budget, HTTP 200 + HTML"]
    C --> R["03 Rendering & Parsing<br/>WRS: JS execution, meta robots, soft 404, canonical"]
    R --> I["04 Canonicalization & Indexing<br/>duplicate clustering, canonical selection, quality"]
    I --> OK["INDEXED"]
    D -.->|"Awaiting crawl"| X1["Discovered - currently not indexed"]
    C -.->|"robots.txt, 5xx, 4xx, redirect errors"| X2["Blocked or HTTP-layer failure"]
    R -.->|"noindex, Soft 404, JS render failure"| X3["Excluded by directive or thin content"]
    I -.->|"Duplicate cluster or low value"| X4["Crawled - currently not indexed"]
```

1. **Discovery:** Google learns that a URL exists via [Sitemap.xml](https://nhanbe.id.vn/building-for-the-web/web-seo/sitemap-xml.md), internal or external links (`<a href="...">`), HTTP redirects (`301`/`302`), or manual URL Inspection submissions. At this point, the URL simply enters the **Crawl Queue**.
2. **Crawling:** Google's crawl scheduler allocates **Crawl Budget** based on _Crawl Capacity Limit_ (your server's health and latency) and _Crawl Demand_ (how popular and stale the URL is). Before sending an HTTP request, **Googlebot** (primarily `Googlebot Smartphone`) checks `/robots.txt` per [RFC 9309](https://nhanbe.id.vn/building-for-the-web/web-seo/robots-txt.md). If allowed, Googlebot fetches the document and inspects the HTTP status code and response headers.
3. **Rendering & Processing:**
   - During initial HTML parsing, Google extracts `<meta name="robots">`, `<link rel="canonical">`, and discoverable `<a href>` links from the raw server response.
   - Provided no `noindex` directive blocks the page, the URL is queued for the **Web Rendering Service (WRS)**—an evergreen headless Chromium instance that executes client-side JavaScript, builds the final DOM, and evaluates whether the rendered view looks like an error or empty state (_Soft 404_).
4. **Canonicalization & Indexing:**
   - Google groups duplicate or near-duplicate pages into a **Duplicate Cluster** and elects a single representative URL as the **Google-selected canonical** (see the [Canonical URL Guide](https://nhanbe.id.vn/building-for-the-web/web-seo/canonical-url-seo.md)).
   - Finally, Google evaluates content quality and usefulness before committing the canonical URL to the **Google Index**.

:::info\[Why Third-Party Crawlers Cannot Replicate GSC]
An external crawler can only observe public signals from **Stages 2 and 3** (HTTP status codes, `robots.txt` rules, `noindex` tags). It has no visibility into Google's internal **Stage 1 crawl queue** (_Discovered – currently not indexed_) or **Stage 4 duplicate clustering and quality thresholds** (_Crawled – currently not indexed_, _Google-selected canonical_).
:::

***

## 2. How to Read the Page Indexing Report

Open **Indexing > Pages** in Google Search Console to view your site's URLs split into two top-level buckets—**Indexed** (green) and **Not indexed** (gray)—followed by the **Why pages aren't indexed** breakdown table.

<div align="center">
  <img src="/imgs/gsc/gsc-page-indexing-report-ui.svg" alt="Anatomy of the Page Indexing Report in Google Search Console" width="100%" />
</div>

### 2.1. The Most Common Misconception: Trying to Drive "Not Indexed" to Zero

According to Google Search Central, **a healthy production website never has 100% of its known URLs indexed**. The `Not indexed` bucket combines two fundamentally different categories:

- **Intentional exclusions (healthy):** `301` redirect source URLs, tracking-parameter variants (`?utm_source=...`), paginated or filtered views canonicalized to a parent page, admin/checkout routes carrying `noindex`, and internal API endpoints blocked by `robots.txt`. Seeing these in `Not indexed` confirms your technical guards are working as designed.
- **Unintended failures (bugs):** Core landing pages, product pages, or articles listed in `sitemap.xml` that drop out of the index due to `5xx` server errors, `Soft 404` responses, broken client-side JavaScript rendering, or canonical mismatches.

### 2.2. The Essential Filter: `All known pages` vs. `All submitted pages`

Use the filter dropdown at the top-left of the Page Indexing report to isolate true regressions:

1. **All known pages:** Every URL Googlebot has ever encountered across the web for your domain—including third-party spam links, arbitrary query strings, and legacy deleted routes.
2. **All submitted pages:** Restricted strictly to the URLs you explicitly declared in the [sitemap.xml](https://nhanbe.id.vn/building-for-the-web/web-seo/sitemap-xml.md) files submitted to GSC.

:::tip\[Golden Rule for Technical Audits]
Always switch the filter to **All submitted pages** first. Because an XML sitemap should contain only canonical, indexable URLs returning `HTTP 200`, **any URL in `All submitted pages` that appears under `Not indexed` is a bug**: either the page itself is failing to index, or your sitemap generator is leaking non-canonical/redirecting URLs into `sitemap.xml`.
:::

### 2.3. Understanding the `Source` Column

Every row in the _Why pages aren't indexed_ table carries a `Source` attribution:

| `Source` Label       | Technical Meaning                                                                                                                                                              | Primary Owner                                                                                                                   |
| :------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------ |
| **`Website`**        | Triggered directly by an explicit HTTP status code, response header, HTML meta tag, or rule served by your infrastructure (`5xx`, `404`, `Soft 404`, `noindex`, `robots.txt`). | **Backend / Frontend / DevOps Engineers** (inspect application code, server logs, CDN/WAF rules, and routing).                  |
| **`Google systems`** | Determined by Google's crawl scheduler, duplicate clustering engine, or quality evaluation (`Discovered - currently not indexed`, `Crawled - currently not indexed`).          | **Technical SEO & Engineering** (optimize SSR/CSR rendering, internal link architecture, crawl budget, and content uniqueness). |

***

## 3. Anatomy of the URL Inspection Tool

When you spot an unexpected spike in a `Not indexed` row, click the status row and run the **URL Inspection Tool** on representative sample URLs.

<div align="center">
  <img src="/imgs/gsc/gsc-url-inspection-anatomy.svg" alt="Anatomy of the URL Inspection Tool in Google Search Console" width="100%" />
</div>

### `Google Index` Tab vs. `Test Live URL`

Engineers are often confused when the default **Google Index** view reports an error (such as _Crawled – currently not indexed_ or _Duplicate_), yet clicking **TEST LIVE URL** immediately returns a green checkmark: _"URL is available to Google"_.

The two modes inspect completely different states:

| Dimension                                             | `Google Index` Tab (Historical State)                                                          | `Test Live URL` Mode (Real-Time Probe)                                                                                                                               |
| :---------------------------------------------------- | :--------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Data source**                                       | Reads the snapshot recorded during Googlebot's most recent background crawl and indexing pass. | Dispatches a live HTTP fetch and headless WRS render **at the exact moment you click the button**.                                                                   |
| **Checks `robots.txt`, HTTP status, and `noindex`**   | Yes (as observed during the last scheduled crawl).                                             | Yes (in real time—ideal for verifying a newly deployed fix).                                                                                                         |
| **Evaluates duplicate clusters & canonical election** | **Yes.** Reports the actual `Google-selected canonical` URL.                                   | **No.** Live Test cannot run site-wide duplicate clustering, so it only confirms the page is fetchable—not that Google will accept your canonical or index the page. |
| **Reports Sitemap membership**                        | **Yes.** Lists which submitted sitemaps contain the URL.                                       | **No.**                                                                                                                                                              |
| **Renders visual screenshot**                         | **No.** Shows captured Rendered HTML, HTTP response, and JS console logs.                      | **Yes.** Captures a live visual screenshot from headless Chromium after JavaScript execution.                                                                        |

***

## 4. Deep Dive: Debugging Every `Not Indexed` Status

Google Search Console categorizes unindexed URLs into over a dozen specific statuses. Here is the engineering root-cause analysis and remediation playbook for each group.

### Group A: Crawl Queue & Quality Evaluation (`Source: Google systems`)

#### 1. `Discovered – currently not indexed`

- **What it means:** Google knows the URL exists (via `sitemap.xml` or a link), but **Googlebot has not yet made an HTTP request to fetch it** (_Last crawl_ shows `N/A`).
- **Root causes:**
  1. **Crawl capacity bottleneck:** Your server's response latency is high or returning elevated error rates, causing Googlebot to throttle its crawl rate to avoid overloading your origin.
  2. **Crawl budget exhaustion (spider traps):** Faceted navigation (`?color=red&size=xl&sort=asc`), infinite calendar links, or session parameters generate hundreds of thousands of low-value URLs that flood the crawl queue.
  3. **Weak internal discovery (orphan pages):** The URL is listed in `sitemap.xml` but has zero internal `<a href>` links pointing to it from indexable pages.
- **How to debug & fix:**
  1. Open **Settings > Crawl stats** in GSC and inspect **Average response time (ms)**. If average TTFB exceeds `500–800 ms`, introduce edge caching (CDN, Redis, AEM Dispatcher) and optimize slow database queries.
  2. Block combinatorial filter and internal search paths in `/robots.txt` (`Disallow: /*?sort=`, `Disallow: /search`).
  3. Add contextual internal links from high-authority category or hub pages to the unindexed pages.

#### 2. `Crawled – currently not indexed`

- **What it means:** Googlebot **fetched and rendered the page** (`HTTP 200 OK`, no `robots.txt` block, no `noindex` directive), but Google's indexing pipeline chose **not** to store it in the search index.
- **Root causes:**
  1. **Client-Side Rendering (CSR) / Hydration failures:** In Single-Page Applications (React, Vue, Angular), the server returns an empty shell (`<div id="app"></div>`). When WRS executes JavaScript to fetch page data, an API call fails due to CORS, missing environment variables, timeouts, or content that only mounts after user interaction (Googlebot does **not** scroll or click buttons). As a result, WRS sees a blank or near-empty DOM.
  2. **Thin or programmatic boilerplate content:** Empty category pages (0 products), sparse tag archives, or programmatic pages that swap out only a city name while keeping 95% identical boilerplate copy.
- **How to debug & fix:**
  1. Open **URL Inspection > View Crawled Page > HTML** and search (`Ctrl+F`) for a unique sentence from your primary body content. If it is missing from the rendered DOM, check **More Info > Page resources** and **JavaScript console messages** for blocked API calls or runtime exceptions.
  2. Migrate SEO-critical routes to **Server-Side Rendering (SSR)**, **Static Site Generation (SSG)**, or **Incremental Static Regeneration (ISR)** so primary content is present in the initial HTML payload.
  3. Automatically emit `<meta name="robots" content="noindex">` on zero-result category pages until inventory is populated.

***

### Group B: Duplicate Content & Canonical Conflicts (`Canonicalization`)

#### 3. `Alternate page with proper canonical tag`

- **What it means:** The URL declares a `<link rel="canonical" href="...">` pointing to another URL, and Google respected your hint by indexing the target canonical instead.
- **Action required?**
  - **None** if the URL is an intentional parameter variant (`?page=1`, `?utm_campaign=...`, `?fbclid=...`, print view).
  - **Fix immediately** if:
    1. The alternate URL is erroneously included in `sitemap.xml` (remove it from your sitemap generator).
    2. A template bug hardcoded `<link rel="canonical" href="https://example.com/" />` across distinct child pages, collapsing them into the homepage.

#### 4. `Duplicate without user-selected canonical`

- **What it means:** Google found multiple URLs serving identical content, and none of them declared a valid `<link rel="canonical">` tag. Google elected one canonical automatically and excluded the rest.
- **Common cause:** The same route resolves under mixed case (`/Rooms/Deluxe` vs. `/rooms/deluxe`), both trailing-slash variants (`/rooms/deluxe/` vs. `/rooms/deluxe`), or arbitrary query strings.
- **How to fix:**
  - Render a **self-referencing `<link rel="canonical">`** on every indexable page:
    ```html
    <link rel="canonical" href="https://hotel.example/rooms/deluxe" />
    ```
  - Enforce lowercase paths and a consistent trailing-slash policy via `301` redirects in your routing middleware.

#### 5. `Duplicate, Google chose different canonical than user`

- **What it means:** Your HTML declared `<link rel="canonical" href="URL_A">`, but Google overruled your hint and elected `URL_B` as the canonical URL.
- **Why Google overrides developer canonicals:**
  1. **Conflicting site signals:** The page's canonical tag points to `URL_A`, but `sitemap.xml` lists `URL_B` and internal `<a href>` navigation links point to `URL_B`.
  2. **Canonicalizing non-equivalent content:** Pointing an out-of-stock product page's canonical tag to its parent category page. Because the two pages do not share duplicate content, Google ignores the canonical hint.
  3. **Client-side JS canonical mutation:** The server HTML outputs `<link rel="canonical" href="URL_A">`, and client-side JavaScript later mutates or appends a second canonical tag pointing to `URL_B`.
- **How to fix:**
  - Inspect the URL in GSC to see which **`Google-selected canonical`** won.
  - Align all four signals to the exact same URL: **`<link rel="canonical">`** = **`sitemap.xml` entry** = **internal `<a href>` links** = **`301` redirect targets**.

***

### Group C: Indexing & Crawling Directives (`Directives & Removals`)

#### 6. `Excluded by ‘noindex’ tag`

- **What it means:** Googlebot crawled the URL and encountered an explicit `noindex` directive in either:
  1. The HTML `<head>`:
     ```html
     <meta name="robots" content="noindex" />
     ```
  2. Or the HTTP response headers (common on PDFs, images, or reverse-proxy rules):
     ```http
     X-Robots-Tag: noindex
     ```
- **Common deployment traps:**
  - Deploying to production with a staging environment variable (`APP_ENV=staging` or `VERCEL_ENV=preview`) that injects `noindex` globally.
  - Shipping `<meta name="robots" content="noindex">` in the initial server HTML and relying on client-side JavaScript to remove it after data loads—Googlebot stops processing for indexing as soon as it sees `noindex` in the raw HTML response.

#### 7. `Blocked by robots.txt`

- **What it means:** A `Disallow` rule in `/robots.txt` prevented Googlebot from fetching the URL. Because Googlebot did not crawl the page, it is normally excluded from the index (unless strong external/internal links point to it, in which case it may surface under the warning _"Indexed, though blocked by robots.txt"_ without a text snippet).

:::warning\[Never Use `robots.txt` to De-Index Already Indexed Pages]
If a set of URLs (such as `/search?q=...` or leaked `/staging/...` paths) is already indexed in Google, **do not immediately add `Disallow` to `robots.txt`**. Blocking a URL in `robots.txt` prevents Googlebot from visiting the page to read a `noindex` tag or `404`/`410` status code—leaving the stale URL trapped in search results indefinitely.

**Correct de-indexing sequence:**

1. Keep the URL **crawlable** in `robots.txt`.
2. Serve `<meta name="robots" content="noindex">`, `X-Robots-Tag: noindex`, or an HTTP `404` / `410` status code.
3. Wait for Googlebot to recrawl and drop the URLs from the index (or use the GSC **Removals** tool for immediate temporary hiding).
4. Only after the URLs move to `Excluded by ‘noindex’ tag` or `Not found (404)` should you add a `Disallow` rule in `robots.txt` to save crawl budget.
   :::

#### 8. `Blocked by page removal tool`

- **What it means:** A property administrator submitted a temporary removal request under **Indexing > Removals** in GSC. Temporary removals hide the URL from search results for roughly **6 months (180 days)**. To restore indexing sooner, cancel the active request in the _Removals_ dashboard.

***

### Group D: HTTP Status Codes, Redirects & WAF Blocks (`Source: Website`)

#### 9. `Server error (5xx)`

- **What it means:** Your server returned an HTTP `500`, `502`, `503`, or `504` status code—or timed out before sending response bytes—when Googlebot requested the URL.
- **Why it is critical:** Sustained `5xx` errors cause Googlebot to drastically throttle your domain's crawl rate and will **drop existing high-ranking pages from the Google Index** if the error persists across multiple recrawl attempts.
- **How to debug:**
  - Filter your web server, reverse proxy, and APM logs (Datadog, New Relic, CloudWatch) by `User-Agent` matching `Googlebot`.
  - Real users often hit warm CDN caches, whereas Googlebot systematically crawls deep pagination and long-tail category routes that miss the cache—triggering database connection pool exhaustion, SSR memory spikes, or origin timeouts.

#### 10. `Not found (404)` vs. `Soft 404`

These two statuses look similar by name but represent opposite technical behaviors:

| Status                                  | HTTP & DOM Behavior                                                                                                                                                                                 | When Is It Healthy vs. Broken?                                                                                                                                                                               |
| :-------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`Not found (404)`** _(or `410 Gone`)_ | Server returns a real `HTTP 404` or `410` status code.                                                                                                                                              | **Healthy** when an item or article was permanently removed with no equivalent replacement. **Only fix** (via a `301` redirect) if the page moved to a new URL or carries valuable backlinks/internal links. |
| **`Soft 404`**                          | Server returns **`HTTP 200 OK`**, but the rendered page displays an error message (_"Product not found"_), renders an empty shell, or bulk-redirects (`301`/`302`) dead URLs to the homepage (`/`). | **Always a bug.** Returning `200 OK` for missing resources wastes crawl budget and confuses index quality signals.                                                                                           |

- **How to fix `Soft 404` errors in modern frameworks:**
  - **Never** bulk-redirect dead URLs to `/`. Only `301` redirect a retired URL when a direct 1-to-1 replacement page exists.
  - In SSR/SPA frameworks (Next.js, Nuxt, Remix, AEM), when a database or CMS lookup returns `null`, explicitly return an HTTP `404` status at the server response layer rather than rendering a client-side `"Not Found"` component with status `200`.

#### 11. `Page with redirect` & `Redirect error`

- **`Page with redirect`:** The URL returned a `301`, `302`, `307`, or `308` redirect. Google follows the redirect and indexes the destination URL instead of the source URL. Simply remove redirecting source URLs from `sitemap.xml` and update internal `<a href>` links to point directly to the final destination.
- **`Redirect error`:** Triggered when:
  - **Redirect chain is too long:** Googlebot follows at most **10 redirect hops** per request (keep production redirects to **1 hop**, or at most 2).
  - **Redirect loop:** For example, a CDN rule redirects `http -> https` while the origin Nginx server redirects `https -> http`, or trailing-slash add/strip rules conflict.
  - **Malformed or empty `Location:` response header.**

#### 12. `Blocked due to unauthorized request (401)`, `access forbidden (403)`, or `other 4xx issue`

- **`401 Unauthorized`:** The route requires HTTP Basic/Digest authentication (often left enabled by mistake after promoting a staging build).
- **`403 Forbidden` & `Other 4xx` (such as `429 Too Many Requests`):**
  - When a public page shows `403` or `429` in GSC, the culprit is almost always a **WAF, CDN, or Bot Protection rule** (Cloudflare Bot Fight Mode, AWS WAF, Akamai, or Nginx rate-limiting) challenging or blocking Googlebot IPs.
  - **How to verify authentic Googlebot requests at the firewall:** Never allowlist based solely on the `User-Agent` string (which anyone can spoof). Verify Googlebot using one of Google's two official methods:
    1. **Reverse DNS (rDNS) + Forward DNS lookup:** Verify the source IP's PTR record resolves to `*.googlebot.com.` or `*.google.com.`, and confirm a forward `A`/`AAAA` lookup on that hostname resolves back to the exact same IP address.
    2. **Official CIDR IP allowlist:** Sync Googlebot's published IP subnets from [`https://developers.google.com/search/apis/ipranges/googlebot.json`](https://developers.google.com/search/apis/ipranges/googlebot.json).

***

## 5. Diagnostic Flowchart & Triage Matrix

When auditing a site with thousands of `Not indexed` URLs, use this decision tree to triage actionable regressions vs. expected exclusions:

```mermaid
flowchart TD
  Start["URL appears under Not Indexed in GSC"] --> CheckImportant{"Should this URL be indexed<br/>as a canonical search landing page?"}
  CheckImportant -->|"No: Admin, filter, tracking param, or retired URL"| CheckSitemap{"Is this URL listed<br/>in sitemap.xml?"}
  CheckSitemap -->|"Yes"| RemoveSitemap["Remove from sitemap.xml<br/>& point internal links to final canonical"]
  CheckSitemap -->|"No"| IgnoreOK["Intentional Exclusion<br/>No action required"]

  CheckImportant -->|"Yes: Core product, article, or category page"| CheckStatus{"Which GSC status group?"}

  CheckStatus -->|"5xx / 403 / 404 / Soft 404 / Redirect error"| FixHTTP["Server / Routing / WAF Layer:<br/>• Fix 5xx crashes & reduce TTFB<br/>• Allowlist verified Googlebot IPs in WAF<br/>• Return HTTP 200 for live pages, 404/410 for dead pages<br/>• Collapse redirect chains to 1 hop"]

  CheckStatus -->|"Blocked by robots.txt / Excluded by noindex"| FixDirective["Directive Layer:<br/>• Unblock path in /robots.txt<br/>• Remove meta noindex & X-Robots-Tag headers"]

  CheckStatus -->|"Duplicate / Alternate canonical"| FixCanonical["Canonicalization Layer:<br/>• Add self-referencing rel='canonical'<br/>• Align Canonical, Sitemap & internal <a href> URLs 100%"]

  CheckStatus -->|"Discovered / Crawled - currently not indexed"| FixQuality["Rendering & Architecture Layer:<br/>• Inspect Rendered HTML in URL Inspection<br/>• Serve primary content via SSR/SSG<br/>• Prune spider traps & add internal links"]
```

### Engineering Triage Matrix

| GSC Status                                        | `Source`         | Priority (when affecting core pages) | Technical Root Cause                                                               | Actionable Fix                                                                          |
| :------------------------------------------------ | :--------------- | :----------------------------------- | :--------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------- |
| **`Server error (5xx)`**                          | `Website`        | **P0 (Critical)**                    | Origin crash, SSR timeout, DB pool exhaustion, or CDN `502`/`504`.                 | Inspect server logs for `Googlebot`, enable edge caching, and optimize slow queries.    |
| **`Excluded by ‘noindex’ tag`**                   | `Website`        | **P0 (Critical)**                    | Leaked `<meta name="robots" content="noindex">` or `X-Robots-Tag: noindex`.        | Audit production env vars and strip `noindex` from public page templates.               |
| **`Blocked due to access forbidden (403)`**       | `Website`        | **P0 (Critical)**                    | WAF, CDN bot challenge, or rate-limiter blocking Googlebot IPs.                    | Allowlist verified Googlebot CIDRs (`googlebot.json`) or rDNS (`*.googlebot.com`).      |
| **`Soft 404`**                                    | `Website`        | **P1 (High)**                        | Empty state/error UI served with `HTTP 200 OK`, or bulk `301` redirects to `/`.    | Return a real HTTP `404`/`410` status from SSR when records are missing.                |
| **`Crawled - currently not indexed`**             | `Google systems` | **P1 (High)**                        | WRS failed to render client-side JS content, or content is thin/boilerplate.       | Verify Rendered HTML in URL Inspection; adopt SSR/ISR; consolidate thin pages.          |
| **`Redirect error`**                              | `Website`        | **P1 (High)**                        | Redirect chain > 10 hops, `A -> B -> A` loop, or invalid `Location` header.        | Collapse redirects to a single `301` hop; fix conflicting CDN/Nginx rewrite rules.      |
| **`Duplicate, Google chose different canonical`** | `Google systems` | **P2 (Medium)**                      | Conflict between `rel="canonical"`, `sitemap.xml`, internal links, or redirects.   | Align canonical tags, sitemap URLs, and internal `<a href>` links to one format.        |
| **`Duplicate without user-selected canonical`**   | `Google systems` | **P2 (Medium)**                      | Missing `<link rel="canonical">` on pages reachable via multiple URL variants.     | Add self-referencing canonical tags and enforce lowercase/trailing-slash redirects.     |
| **`Discovered - currently not indexed`**          | `Google systems` | **P2 (Medium)**                      | Crawl budget exhaustion, slow server TTFB, or orphan pages without internal links. | Block filter traps in `robots.txt`, keep TTFB \< 500 ms, and add internal links.        |
| **`Alternate page with proper canonical tag`**    | `Website`        | **P3 (Verify)**                      | Parameterized or alternate URL properly canonicalized to its primary URL.          | Expected behavior. Verify none of these alternate URLs appear in `sitemap.xml`.         |
| **`Page with redirect`**                          | `Website`        | **P3 (Verify)**                      | URL returns a valid `301`/`302` redirect.                                          | Expected behavior. Remove source URLs from `sitemap.xml` and update internal links.     |
| **`Not found (404)`**                             | `Website`        | **P3 (Verify)**                      | URL returns `HTTP 404`.                                                            | Leave as `404` if permanently removed; `301` redirect only if a 1:1 replacement exists. |

***

## 6. Code Patterns: Fixing Indexing Bugs in Application Code

### 6.1. Preventing `Soft 404` and Setting Self-Referencing Canonicals in Next.js (App Router)

A classic bug in React and Next.js applications occurs when a database lookup returns `null` and the component renders a `"Room not found"` message without calling `notFound()`. Because the server still responds with `HTTP 200 OK`, Google flags the URL as a **Soft 404**.

```tsx title="app/rooms/[slug]/page.tsx"
import { notFound } from 'next/navigation';
import type { Metadata } from 'next';

interface PageProps {
  params: Promise<{ slug: string }>;
}

// 1. Emit a clean self-referencing canonical URL stripped of tracking query params
export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
  const { slug } = await params;
  const room = await fetchRoomBySlug(slug);

  if (!room) {
    return {
      title: 'Room Not Found',
      robots: { index: false, follow: false },
    };
  }

  const canonicalUrl = `https://hotel.example/rooms/${room.slug}`;

  return {
    title: `${room.name} | Hotel Example`,
    description: room.summary,
    alternates: {
      canonical: canonicalUrl,
    },
    robots: {
      // Proactively noindex unpublished listings before they become thin pages
      index: room.isPublished,
      follow: true,
    },
  };
}

// 2. Return a real HTTP 404 status at the SSR layer when the record does not exist
export default async function RoomDetailPage({ params }: PageProps) {
  const { slug } = await params;
  const room = await fetchRoomBySlug(slug);

  if (!room) {
    // Calling notFound() instructs Next.js to send a true HTTP 404 status code
    notFound();
  }

  return (
    <main>
      <h1>{room.name}</h1>
      <p>{room.description}</p>
    </main>
  );
}
```

### 6.2. Protecting Staging Environments Without Leaking `noindex` to Production (Nginx)

Instead of hardcoding `<meta name="robots" content="noindex">` in HTML templates (where it can easily be merged from `staging` into `main` by mistake), enforce non-production indexing blocks at the reverse-proxy or CDN layer via the `X-Robots-Tag` HTTP response header:

```nginx title="/etc/nginx/conf.d/staging.conf"
server {
    listen 443 ssl http2;
    server_name staging.hotel.example;

    # Block search engines from indexing any asset (HTML, PDF, images) on staging
    add_header X-Robots-Tag "noindex, nofollow, noarchive" always;

    location / {
        proxy_pass http://backend_upstream;
    }
}
```

### 6.3. Automating Bulk Diagnostics with the GSC URL Inspection API

When auditing hundreds of URLs, clicking through the GSC web UI one URL at a time is impractical. Google provides the official **`urlInspection.index.inspect`** REST endpoint to programmatically retrieve `verdict`, `coverageState`, `robotsTxtState`, `googleCanonical`, `userCanonical`, and `lastCrawlTime`.

:::info\[URL Inspection API Quota Limits]
Per Google Search Console API documentation, usage is capped per Search Console property at:

- **2,000 queries per day**
- **600 queries per minute**
  :::

Below is a Node.js script using the official `googleapis` SDK to batch-inspect a list of URLs and print a diagnostic table:

```javascript title="scripts/inspect-urls.mjs"
import { google } from 'googleapis';

const SITE_URL = 'https://hotel.example/'; // Or 'sc-domain:hotel.example' for a Domain property
const KEY_FILE_PATH = './service-account-key.json';

async function inspectBatchUrls(urls) {
  const auth = new google.auth.GoogleAuth({
    keyFile: KEY_FILE_PATH,
    scopes: ['https://www.googleapis.com/auth/webmasters.readonly'],
  });

  const searchconsole = google.searchconsole({ version: 'v1', auth });
  const results = [];

  for (const inspectionUrl of urls) {
    try {
      const response = await searchconsole.urlInspection.index.inspect({
        requestBody: {
          inspectionUrl,
          siteUrl: SITE_URL,
          languageCode: 'en-US',
        },
      });

      const indexResult = response.data.inspectionResult?.indexStatusResult;
      results.push({
        url: inspectionUrl,
        verdict: indexResult?.verdict,               // PASS, NEUTRAL, or FAIL
        coverageState: indexResult?.coverageState,   // e.g., "Crawled - currently not indexed"
        pageFetchState: indexResult?.pageFetchState, // SUCCESSFUL, SOFT_404, SERVER_ERROR...
        lastCrawlTime: indexResult?.lastCrawlTime,
        userCanonical: indexResult?.userCanonical,
        googleCanonical: indexResult?.googleCanonical,
      });
    } catch (error) {
      console.error(`[Error] Failed to inspect ${inspectionUrl}:`, error.message);
    }
  }

  console.table(results);
}

inspectBatchUrls([
  'https://hotel.example/rooms/deluxe',
  'https://hotel.example/rooms/deluxe?view=ocean',
  'https://hotel.example/offers/expired-promo',
]);
```

***

## 7. Pre-Flight Checklist Before Clicking "Validate Fix"

After deploying a fix to production, walk through these four verification steps before clicking **Validate Fix** in Google Search Console:

1. **Verify raw HTTP headers through your live CDN / Reverse Proxy:** Run `curl -I https://hotel.example/path` to confirm the CDN cache has been purged and the endpoint returns the expected HTTP status code, `X-Robots-Tag`, `Location`, and `Cache-Control` headers.
2. **Run `Test Live URL` on 3–5 sample URLs:** In GSC, inspect several affected URLs, click **TEST LIVE URL**, and check **View Tested Page > HTML / Screenshot** to confirm Googlebot sees the updated status code, canonical tag, and rendered DOM.
3. **Trigger `Validate Fix` in the Page Indexing report:**
   - Validation transitions to **`Started`**.
   - Google immediately probes a small sample of URLs. If any sample URL still exhibits the error, validation halts and reports **`Failed`**.
   - If the initial sample passes, Google queues the remaining URLs in the bucket for recrawling. Full validation (**`Passed`**) typically takes **several days to two weeks**, depending on your site's size and crawl budget.
4. **Skip validation for intentional statuses:** Informational buckets such as `Page with redirect` (for legitimate redirects) or `Blocked by page removal tool` do not require validation unless the status was caused by a misconfiguration you just reverted.

***

## 8. Official References

All status definitions, technical thresholds, and remediation workflows in this guide are cross-referenced against official Google Search Central and Search Console documentation:

1. [Page Indexing Report — Google Search Console Help](https://support.google.com/webmasters/answer/7440203)
2. [URL Inspection Tool — Google Search Console Help](https://support.google.com/webmasters/answer/9012289)
3. [Crawl Stats Report — Google Search Console Help](https://support.google.com/webmasters/answer/9679690)
4. [How Google Search Works (Crawling, Indexing, Serving) — Google Search Central](https://developers.google.com/search/docs/fundamentals/how-search-works)
5. [Consolidate Duplicate URLs & Canonicalization — Google Search Central](https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls)
6. [Robots Meta Tags & `X-Robots-Tag` Specifications — Google Search Central](https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag)
7. [Fix Search-Related JavaScript Problems (Web Rendering Service) — Google Search Central](https://developers.google.com/search/docs/crawling-indexing/javascript/fix-search-javascript)
8. [Crawl Budget Management for Large Sites — Google Search Central](https://developers.google.com/search/docs/crawling-indexing/large-site-managing-crawl-budget)
9. [HTTP Status Codes, Network Errors, and Soft 404s — Google Search Central](https://developers.google.com/search/docs/crawling-indexing/http-network-errors)
10. [Redirects and Google Search (Maximum Hops & Loop Handling) — Google Search Central](https://developers.google.com/search/docs/crawling-indexing/301-redirects)
11. [Verifying Googlebot and Other Google Crawlers (rDNS & IP Ranges) — Google Search Central](https://developers.google.com/search/docs/crawling-indexing/verifying-googlebot)
12. [URL Inspection API Reference & Quota Limits — Google Developers](https://developers.google.com/webmaster-tools/v1/urlInspection.index/inspect)
