# Internal Linking Mesh, Nav-Orphan & Link Spam Auditor (`cephaso/internal-linking-mesh-auditor`) Actor

DOM-isolated internal PageRank, paginated archive click depth, nav-masked orphan discovery, entity-guarded broken-slug repair, Google Link Spam rel='sponsored' compliance, and bidirectional anchor-hook planner.

- **URL**: https://apify.com/cephaso/internal-linking-mesh-auditor.md
- **Developed by:** [Cephas Omaku](https://apify.com/cephaso) (community)
- **Categories:** SEO tools, Developer tools, Agents
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.00 / 1,000 page auditeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Internal Linking Mesh, Nav-Orphan & Link Spam Auditor

Replace legacy desktop crawler CSV dumps with an automated, DOM-isolated link topology, Google Link Spam compliance, and bidirectional internal-linking blueprint.

Unlike standard SEO crawlers that mix header/footer navigation links with article prose or charge `$0.04+/page` for basic meta checklists, this pure-Python engine separates **editorial body links** from **layout chrome**—surfacing **Nav-Masked Orphans**, entity-guarded broken-slug fixes, missing `rel="sponsored"` compliance leaks, and ready-to-insert paragraph anchor hooks.

***

### Why Use This Actor Instead of Standard Link Crawlers?

1. **DOM Chrome Isolation (`in_degree_body` vs. `in_degree_nav`)**
   Strips `<header>`, `<nav>`, `<footer>`, `<aside>`, ARIA `navigation`/`banner`/`contentinfo`/`complementary`, cookie banners, `.sharedaddy`/`.a2a_kit` sharebars, and related-post widgets before scoring link equity—revealing **Nav-Masked Orphans** (`in_degree_nav > 0`, `in_degree_body == 0`) that lose crawl authority as soon as widgets rotate.
2. **Rate-Normalized Internal PageRank (`d = 0.85`) & Paginated Archive Click Depth**
   Runs 35-iteration damped PageRank over body edges, merges rendered homepage `/` links with Dijkstra traversal across paginated category/tag archives (`depth >= 4` alerts), and normalizes scores per page/link density so 200+ page sites avoid `0/100` score saturation.
3. **Entity-Guarded Broken Internal Slug Resolver**
   Matches internal 404/broken slugs to live catalog URLs (`>= 0.68` Jaccard + sequence score) with a distinctive-entity contradiction guard so shared suffixes (e.g., `-migration-guide`) never mis-map distinct cities, versions, or products.
4. **Google Link Spam `rel="sponsored"` & Authority Firewall**
   Classifies external links across 5 trust tiers (`statutory_gov_edu`, `primary_docs_ref`, `editorial_citation`, `commercial_affiliate`, `low_trust_or_shortener`), exempts `.gov`/`.edu`/primary docs/Creative Commons deeds from equity caps, detects affiliate params missing `rel="sponsored"`, flags `http://` downgrades and missing `rel="noopener"`, and optionally probes external links (`HEAD` with automatic `GET` fallback on `>= 400`/errors).
5. **Multiplicative Bidirectional Mesh Solver (`targetPath` Optional)**
   Pass any single page (`targetPath`) to rank top **inbound donor articles** and **outbound orphan-rescue targets** gated multiplicatively by BM25 + entity + narrow taxonomy relevance, returning verified outside-`<a>` `inline_wrap` anchor spans (`p#2+` deep-body preference) or contextual bridge fallbacks.

***

### Ingestion Modes & Recommended Scale Limits

Built as a single-process in-memory graph & BM25 solver for **curated editorial blogs, SaaS/docs hubs, and business websites**:

| Mode (`source`) | Recommended Sweet Spot | Practical Upper Ceiling | Notes |
| :--- | :--- | :--- | :--- |
| **`sitemap`** | **80 – 500 pages** | **1,500 – 2,500 pages** | Auto-discovers sitemaps via `robots.txt` / `/sitemap_index.xml` / `/sitemap.xml` with polite sequential fetching. |
| **`wp-rest`** | **Up to 5,000 pages** | **5,000 pages (max input)** | Reads `/wp-json/wp/v2/` posts & pages (`50`/call) + category/tag ancestry (up to `1,500` taxonomy terms) and merges live homepage `/` links. |

For `> 5,000`-page websites, set `maxPages` to audit priority slices cleanly within predictable time and cost.

***

### Output Deliverables

Every run stores:

- **Dataset Rows (`record_type` tagged):**
  - `summary` — Composite Mesh Health Score (`0–100`), Topology Score, External Hygiene Score, Orphan/Deep/Broken counts, and External Tier breakdown.
  - `node_metric` — Per-page PageRank (`0–100`), `click_depth`, `in_degree_body`, `in_degree_nav`, `out_degree_body`, `is_orphan`, and `nav_masked_orphan`.
  - `broken_internal_link` — Broken hrefs with verified catalog repair candidates and confidence scores.
  - `external_issue` — `HIGH`/`MEDIUM`/`LOW` Sorted compliance & broken-link remediation items.
  - `mesh_opportunity` — Ranked inbound/outbound paragraph hooks (`inline_wrap` vs `bridge_sentence`) when `targetPath` is provided.
- **Key-Value Store Files:**
  - `OUTPUT` — Complete structured JSON payload.
  - `REPORT.md` — Copy-ready Markdown executive audit & bidirectional link blueprint.

***

### Pricing (Pay-Per-Event)

- **`actor-start`**: Charged once when execution begins (`$0.001`).
- **`page-audited`**: Charged per ingested & scored page (`$0.008/page`), strictly honoring your configured spending limit (`event_charge_limit_reached`).
- **`external-link-probed`**: Charged per unique external URL checked (`$0.001/link`) only when `probeExternal: true`.

***

### Live Benchmark Example (`docs.astral.sh/uv/`, 84 Pages)

Running the Actor with `targetPath: "https://docs.astral.sh/uv/guides/projects/"`, `maxPages: 84`, `probeExternal: true`, `maxExternalProbes: 25`:

- **Runtime & Footprint:** `53.4s` (`77.8 MiB` peak RAM, `0.00741` CU), outputting `159` structured dataset rows (`1` `summary`, `84` `node_metric`, `60` `external_issue`, `14` `mesh_opportunity`) + `REPORT.md` + `OUTPUT`.
- **Site-Wide Findings:** `Composite: 78/100` (`Topology: 88/100` | `External Hygiene: 59/100`), `313` editorial body edges (`3.73/page`), `5` nav-masked orphans (`in_degree_body: 0`, `in_degree_nav: 83`), `0` broken internal slugs, `117` authoritative exempt external links, and `25/25` healthy live external HTTP probes.
- **Sample Output Row (`summary`):**

```json
{
  "record_type": "summary",
  "domain": "docs.astral.sh",
  "composite_score": 78,
  "topology_score": 88,
  "external_health_score": 59,
  "total_docs": 84,
  "total_body_edges": 313,
  "mean_body_inlinks": 3.73,
  "orphan_count": 5,
  "deep_or_unreachable_count": 0,
  "broken_internal_count": 0,
  "total_external_links": 467,
  "authoritative_exempt_links": 117,
  "equity_dofollow_links": 350,
  "external_issues_count": 158,
  "high_severity_external_count": 11,
  "target_path": "/uv/guides/projects/"
}
```

# Actor input Schema

## `siteUrl` (type: `string`):

Root website URL to audit (including https://), e.g. https://apify.com. Sitemaps are auto-discovered from robots.txt, /sitemap_index.xml, or /sitemap.xml (falls back to homepage seed link crawl if no sitemap exists).

## `source` (type: `string`):

Choose how pages and taxonomies are fetched:

- **sitemap**: Auto-discovers XML sitemaps and crawls rendered HTML (recommended sweet spot: 80-500 pages, practical ceiling: 2,500 pages).
- **wp-rest**: Reads WordPress REST `/wp-json/wp/v2/` posts, pages, and full category/tag ancestry while merging rendered homepage links (recommended sweet spot: up to 5,000 pages).

## `targetPath` (type: `string`):

Optional canonical path, slug, or full URL on the site (e.g. /guides/connection-pooling/). When provided, scores inbound donor articles and outbound orphan-rescue candidates using multiplicative BM25 + entity + narrow taxonomy gating, returning ready-to-insert inline anchor hooks.

## `maxPages` (type: `integer`):

Maximum number of pages ingested and scored per run. Recommended: 10-500 for sitemap crawls (up to 2,500 practical ceiling) and up to 5,000 for wp-rest.

## `maxInbound` (type: `integer`):

Maximum top-ranked inbound donor suggestions returned when targetPath is set.

## `maxOutbound` (type: `integer`):

Maximum outbound link opportunities (prioritizing orphans) returned when targetPath is set.

## `probeExternal` (type: `boolean`):

Perform live HTTP HEAD checks (with automatic GET fallback on >=400/errors) on unique external outbound URLs to detect dead 404/410 links. Adds $0.001 per unique external URL checked.

## `maxExternalProbes` (type: `integer`):

Upper cap on unique external URLs probed when probeExternal is true.

## `maxEquityRatioFloor` (type: `integer`):

Page-level equity-dilution threshold for non-authoritative outbound dofollow links before flagging EXTERNAL_EQUITY_DILUTION.

## `maxDensityPer1k` (type: `number`):

Word-normalized density threshold for flagging EXCESSIVE_EXTERNAL_DENSITY (authoritative .gov/.edu/docs/CC citations are exempt).

## Actor input object example

```json
{
  "siteUrl": "https://apify.com",
  "source": "sitemap",
  "maxPages": 10,
  "maxInbound": 8,
  "maxOutbound": 6,
  "probeExternal": false,
  "maxExternalProbes": 25,
  "maxEquityRatioFloor": 12,
  "maxDensityPer1k": 20
}
```

# Actor output Schema

## `results` (type: `string`):

Summary telemetry, page PageRank/click-depth metrics, broken internal slugs, external link compliance flags, and bidirectional hook opportunities.

## `reportMarkdown` (type: `string`):

Copy-ready Markdown scorecard, nav-masked orphans, broken slug repairs, external compliance issues, and target anchor hooks.

## `fullJsonReport` (type: `string`):

Complete structured JSON audit payload stored under the default key-value store OUTPUT record.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "siteUrl": "https://apify.com"
};

// Run the Actor and wait for it to finish
const run = await client.actor("cephaso/internal-linking-mesh-auditor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "siteUrl": "https://apify.com" }

# Run the Actor and wait for it to finish
run = client.actor("cephaso/internal-linking-mesh-auditor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "siteUrl": "https://apify.com"
}' |
apify call cephaso/internal-linking-mesh-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,cephaso/internal-linking-mesh-auditor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Z63CCodNFhmp7XG7n/builds/FIQzgCf3My59r2jOP/openapi.json
