Skip to main content

How to Find Orphan Pages: 640 Sitemap URLs, 2 Unreachable

How to find orphan pages: diff your sitemap against every <a href> in your build. 640 URLs, 2 with no click path, and why inlinks did not predict indexing.

• • 10 min read
Dashboard cover for a post on finding orphan pages: sitemap URLs and the internal link graph flow into a diff that flags pages with zero inlinks and no click path from the homepage

TL;DR — How to find orphan pages: take every URL in your sitemap, take every URL that appears in an <a href> anywhere in your HTML, and subtract. Then run a breadth-first search from the homepage, because a page can have inlinks and still have no click path. On this site’s 640 sitemap URLs that found 1 true orphan and 1 more page reachable only through it. And across 156 posts with a Search Console verdict, the number of in-article links pointing at a post did not predict whether Google indexed it.

An orphan page is a URL you want indexed that no other page on your site links to. It can still be found through the sitemap or an outside link. It just gets nothing from your own internal links: no path for a crawler to follow, no click path for a reader, and no signal that you think it matters.

This is a 45-line script, not a paid crawler subscription. The run below is against this site’s own pnpm build output on November 12, 2026.

What Is an Orphan Page?

Google’s guidance on crawlable links puts the rule in one line: “Every page you care about should have a link from at least one other page on your site.” The same page says Google “uses links as a signal when determining the relevancy of pages and to find new pages to crawl.” So links do two jobs, discovery and relevance. An orphan gets neither from your own site.

Five related problems get lumped together. They need different checks:

ProblemDefinitionHow the audit catches itUsual cause
OrphanIn the sitemap, zero internal inlinksInlink count = 0Page shipped, nav never updated
UnreachableHas inlinks, but no click path from /Missing from homepage BFSOnly linked from another orphan
Too deepReachable, but more than 3 clicks from /BFS depth > 3Long paginated archives
UnlistedBuilt and linked, but not in the sitemapIn the HTML set, not the sitemap setSitemap generator skips a route
Fake link“Linked” with onclick or a <span>Never enters the graphJS-only navigation

The last row matters because Google’s crawlable-links page also says it “can’t reliably extract URLs from <a> elements that don’t have an href attribute.” The script below only counts <a href>, the same thing Googlebot reliably follows. A button that routes with JavaScript does not count as a link here, and it shouldn’t.

How to Find Orphan Pages in 5 Steps

  1. Build or crawl the site to HTML. On a static site, the build directory is already the full set of pages. On a server-rendered site, crawl from / with a crawler that saves HTML, then point the script at that folder.

  2. Load every sitemap. Pass each sitemap file, not just the index. This site has sitemap.xml for pages and blog-sitemap.xml for posts.

  3. Extract every <a href> per page. Resolve relative URLs against the page’s own path, drop other origins, and normalize trailing slashes and .html so /about, /about/ and /about.html are one node.

  4. Count inlinks and walk from the homepage. Any sitemap URL with zero inlinks is an orphan. Any sitemap URL the breadth-first search never reaches is unreachable.

  5. Diff in both directions. Sitemap minus links finds orphans. Links minus sitemap finds pages you link to but never declared.

The whole thing, Node 20, no dependencies:

JavaScript
// orphan-pages.mjs — usage: node orphan-pages.mjs <build-dir> <origin> <sitemap.xml...>
import fs from 'node:fs';
import path from 'node:path';

const [dir, origin, ...sitemaps] = process.argv.slice(2);
const walk = (d) => fs.readdirSync(d, { withFileTypes: true })
  .flatMap((e) => e.isDirectory() ? walk(path.join(d, e.name)) : [path.join(d, e.name)]);
const norm = (href, base = '/') => {
  try {
    const u = new URL(href, origin + base);
    if (u.origin !== origin) return null;
    const p = u.pathname.replace(/(index)?.html$/, '').replace(/(.)/$/, '$1');
    return p || '/';
  } catch { return null; }
};

// 1. Every URL the sitemap promises
const listed = new Set(sitemaps.flatMap((f) =>
  [...fs.readFileSync(f, 'utf8').matchAll(/<loc>([^<]+)</loc>/g)].map((m) => norm(m[1]))));

// 2. Every <a href> in every built page -> edge list
const out = new Map();
for (const f of walk(dir).filter((f) => f.endsWith('.html'))) {
  const page = norm('/' + path.relative(dir, f));
  const html = fs.readFileSync(f, 'utf8');
  const targets = [...html.matchAll(/<a[^>]*href="([^"#][^"]*)"/g)]
    .map((m) => norm(m[1].replaceAll('&amp;', '&'), page)).filter((t) => t && t !== page);
  out.set(page, new Set(targets));
}

// 3. Inlink counts + click depth from the homepage (BFS)
const inlinks = new Map();
for (const [, ts] of out) for (const t of ts) inlinks.set(t, (inlinks.get(t) ?? 0) + 1);
const depth = new Map([['/', 0]]);
for (const queue = ['/']; queue.length; ) {
  const p = queue.shift();
  for (const t of out.get(p) ?? []) if (!depth.has(t)) { depth.set(t, depth.get(p) + 1); queue.push(t); }
}

// 4. Report
const report = (label, urls) => console.log(`${label}: ${urls.length}\n${urls.map((u) => '  ' + u).join('\n')}`);
report('Orphans (in sitemap, zero inlinks)', [...listed].filter((u) => !inlinks.get(u)));
report('Unreachable from / (in sitemap, no click path)', [...listed].filter((u) => !depth.has(u)));
report('Deeper than 3 clicks', [...listed].filter((u) => depth.get(u) > 3));
report('Built but not in sitemap', [...out.keys()].filter((u) => !listed.has(u)));

Run it against a build:

Bash
node orphan-pages.mjs build https://umesh-malik.com build/sitemap.xml build/blog-sitemap.xml

On 643 HTML files it finishes in 0.53 seconds. That is cheap enough to run in CI on every deploy, which is where it belongs: orphans show up when someone ships a page, not on a schedule.

Two shortcuts in the script are deliberate. A regex is not an HTML parser, but prerendered output is machine-generated and regular, so <a href="…"> is reliable there. Use a real parser if your HTML is hand-written. And every <a> counts, including header and footer links. That is correct for discovery, because Googlebot follows nav links too. It is wrong for measuring editorial weight, which the indexing section below gets into.

What Did the Audit Find on 640 URLs?

The sitemaps list 640 URLs. The build holds 641 pages once you drop the generated 404. Output:

Text
Orphans (in sitemap, zero inlinks): 1
  /ai-summary
Unreachable from / (in sitemap, no click path): 2
  /ai-summary
  /press
Deeper than 3 clicks: 0
Built but not in sitemap: 2
  /404
  /design

What each line means:

  • /ai-summary is a true orphan. It is a summary page for AI agents, advertised in <head> as <link rel="describedby" href="/ai-summary">. A <link> element is not an <a href>, so as far as the internal link graph goes, nothing points at it.

  • /press is the case inlink counting misses. It has an inlink, exactly one, and that inlink comes from /ai-summary. So its inlink count is 1 and a count-only audit passes it, but no click path reaches it from the homepage. Only the breadth-first search catches it.

  • /design is fine. It is the internal design-system page, deliberately noindex and deliberately left out of the sitemap. Every result needs a human look, and this one is intended.

  • Nothing is deeper than 3 clicks. One URL at depth 0, 32 at depth 1, 605 at depth 2. The blog index, tag pages and category pages fan out to every post, so no post is more than two clicks from the homepage.

Bar chart of click depth from the homepage for 640 sitemap URLs: 1 page at depth 0, 32 at depth 1, 605 at depth 2, none deeper than 3, and 2 URLs with no click path at all, /ai-summary and /press

The fix for both is one link from a page that is already reachable, such as a footer entry. It is a one-line change, so the real lesson is in how they got there. /press was linked from exactly one place, and that place was a page built for machines rather than readers.

Do Orphan Pages Get Indexed?

Both of them did. In the Search Console URL Inspection report committed on October 2, 2026, /ai-summary and /press were both “Submitted and indexed.” Google’s sitemaps overview explains how: the sitemap is a discovery channel of its own. It also says a sitemap “doesn’t guarantee that all the items in your sitemap will be crawled and indexed,” so this is not something to count on.

The more useful question is whether weaker internal linking hurt indexing on this site. To test it, I counted in-article links: links written inside a post’s Markdown body that point at another post. Nav, tag and listing links don’t count. I rebuilt that graph from the repository as it stood on October 2, so the link counts match the date of the index report, and grouped the 156 posts that had an indexed or not-indexed verdict:

In-article links pointing at the postPostsIndexedIndexed rate
0191894.7%
1131292.3%
2-3595491.5%
4-9484185.4%
10+171694.1%
All15614190.4%

There is no gradient. Posts nobody linked to from another article were indexed at 94.7%, the same as posts with ten or more such links.

Bar chart of Google indexing rate by number of in-article links pointing at each post, from the October 2, 2026 Search Console report: 94.7 percent with 0 links, 92.3 with 1, 91.5 with 2-3, 85.4 with 4-9 and 94.1 with 10 or more, flat around the 90.4 percent site average

That is not evidence that internal links don’t matter. It is evidence that on this site, they were not the bottleneck for indexing. In today’s build, every post has at least 6 HTML inlinks (median 16) from listing, tag and category pages, and every post sits 2 clicks from the homepage. The site used the same templates in October. With that floor in place, a few extra in-article links don’t change whether Google crawls and indexes a post. The 15 posts stuck in “Crawled — currently not indexed” were spread evenly across the buckets, which points at the content rather than the links.

The caveats are real. This is one site, 156 posts, and indexing is a yes/no outcome. It says nothing about ranking, where Google says link relevance is a signal. A site without tag pages and a full blog index would not have that floor, and orphans there would be the whole story.

When Should You Worry About Orphan Pages?

The audit is cheap. Whether its findings matter depends on how your site is built:

Site shapeOrphan riskWhat to run
Static blog with full index + tag pagesLow for posts, real for one-off pagesDiff in CI; fix the stragglers
Docs site with sidebar nav generated from filesLowDiff once per release
E-commerce with faceted category pagesHigh: products drop out of categoriesDiff + BFS weekly, alert on new orphans
CMS with hand-curated menusHigh: pages ship without menu entriesDiff on every publish
Large site with paginated archivesDepth, not orphansBFS depth histogram; fix anything > 3

The pattern from this audit generalizes: the pages that go orphan are the one-off pages, not the templated ones. Posts are listed by code, so they can’t go orphan. /press and /ai-summary were placed by hand, and hand-placed pages are the ones that drift.

What Breaks If You Get the Audit Wrong?

  • Counting <link> and onclick as links. Your audit says the page is linked and Googlebot disagrees. Count <a href> only.

  • Inlink counts without a homepage BFS. You miss pages like /press that are linked only from another orphan.

  • Not normalizing URLs. /about and /about/ become two nodes, and each looks half-linked. Normalize before you count.

  • Auditing the sitemap index instead of the sitemaps. sitemap-index.xml lists sitemaps, not pages. Pass every child sitemap.

  • Treating every finding as a bug. /design and /404 are out of the sitemap on purpose. Keep an allowlist so CI fails only on new findings.

  • Crawling a JavaScript app’s raw HTML. If links appear only after hydration, the script sees an empty graph. Audit rendered HTML, as covered in the document.currentScript rendering post.

How This Fits the Rest of a Technical SEO Audit

Orphan detection answers “can a crawler find it through my site?” The neighbouring checks answer the next questions. Whether Googlebot is allowed in at all is the Cloudflare bot-blocking problem. Whether a recrawl wastes bandwidth is serving 304 Not Modified with a stable ETag. Whether paginated archives are linked correctly is the rel=next header audit. Whether the sitemap’s dates can be trusted is fixing sitemap lastmod from real content edits. Whether the links you do have point at a URL that answers 200, rather than one that 301s, is the Page with redirect audit. For agents rather than search engines, making a site agent-readable covers the machine-facing side, which is where /ai-summary came from. What to do when a crawled post still is not indexed is splitting stuck pages by age and last crawl. When Google knows a URL but never fetches it, fixing Discovered currently not indexed covers the crawl-demand side. The AI search hub collects the rest.

FAQ

What is an orphan page in SEO?

An orphan page is a URL you want indexed that no other page on your site links to. Crawlers can still find it through a sitemap or an external link, but no internal link points at it. Google’s own guidance is that every page you care about should have a link from at least one other page on your site.

How do I find orphan pages without a paid crawler?

Take the set of URLs in your sitemap, build the set of URLs that appear in an <a href> on any page of your site, and subtract the second from the first. On a static site you can read the build output directly, which takes about half a second for 640 pages with a 45-line Node script. On a dynamic site, crawl from the homepage first and run the same diff on the crawled HTML.

Can an orphan page still be indexed by Google?

Yes. A sitemap is a discovery channel on its own, and both orphans in this audit were indexed through it. What an orphan loses is the internal link signal: Google says it uses links to judge relevance as well as to find pages, and an orphan gets none of that from your own site.

What is the difference between an orphan page and an unreachable page?

An orphan has zero internal inlinks. An unreachable page may have inlinks, but every page linking to it is itself an orphan or another unreachable page, so there is no click path from the homepage. Inlink counting misses the second case, which is why the audit should also run a breadth-first search from the homepage.

How deep should important pages be?

Close to the homepage. Common practice is three clicks or fewer for anything you want ranked. On this site 638 of 640 sitemap URLs sit at depth 2 or less because the blog index, tag pages and category pages fan out to every post, which is why the depth check reported nothing deeper than 3.

Sources

  • Google Search Central, Make your links crawlable
  • Google Search Central, Learn about sitemaps
  • Sitemaps.org, Sitemaps XML format
  • First-party measurement: orphan-pages.mjs run against the umesh-malik.com pnpm build output (640 sitemap URLs, 643 HTML files), November 12, 2026; indexing rates joined against the repository’s Search Console URL Inspection report and in-article link graph as committed on October 2, 2026

Frequently asked questions

Share this article:
X LinkedIn

Google Search · Preferred sources

Prefer this site on Google

If you already read this writing, add umesh-malik.com as a Preferred Source. Google can then highlight it with a preferred badge in Top Stories, AI Overviews, and AI Mode — for you, not as a site-wide ranking boost.

Keep reading

Get new posts on AI, Claude Code & LLMs

New deep-dives on AI engineering, Claude Code, and developer tooling — follow along however you prefer.