# Internal Link Pass

Finds published pages that genuinely relate to each other and adds contextual internal links between them, then reports every anchor it added so you can scan the run in one place.

- Category: Content
- Steps: 1
- Cadence: Runs weekly
- Cost: Runs inside the Free plan allowance at the weekly default.
- Version: 1

## What gets installed

- A Link Demo Posts type with 3 related posts and no links yet
- A Link Report type that names every anchor added
- Elena, SEO Analyst as the agent
- One weekly workflow, schedule off until you enable it

Installs into an existing project. Existing content is not overwritten, and the recurring schedule stays off until it is turned on in the dashboard.

## How it works

# Internal Link Pass

A weekly workflow that finds published pages covering related subjects and links them to each other, then reports every anchor it added.

## What it installs

- `link-posts`: three related posts with no internal links, so the first run has real opportunities
- `link-report`: one object per run, naming every anchor added
- Agent: Elena, SEO Analyst (`seo-analyst`)
- One weekly workflow, created with its recurring schedule disabled

## Why this is different

Relevance comes from `search_content`, which is semantic: it matches on meaning across the whole bucket rather than on shared keywords. Tools that bolt linking onto a CMS from outside only see the pages you hand them.

## Install it

Hosted MCP endpoint: `https://mcp.cosmicjs.com/v1/buckets/{bucket-slug}`

Or install in one click from https://www.cosmicjs.com/marketplace/workflows/internal-link-pass

## The prompt

```text
Add internal links between published pages that genuinely relate to each other, and report every anchor you add.

Rules, in order of importance. Read them before you write anything.
1. The only edit you may make to a body field is wrapping text that is already there in a link. Do not reword, rewrite, reorder, reformat, summarize, or add sentences. If the body cannot be linked without changing the prose, skip the object and say so in the report.
2. Never insert a link inside a heading, a code block, a blockquote, a table, or existing link text.
3. Match the format of the field you are editing: markdown links for markdown and rich-text fields, an anchor tag for HTML fields.

How to do the pass.
4. Read at most {{max_objects}} published objects that have a body field. Stop at that number even if more remain.
5. For each one, use search_content to find other published objects in this bucket that cover a related subject. Only link when the target actually covers the phrase you are linking: a link that surprises the reader is worse than no link.
6. Link to {{link_path}}/SLUG, where SLUG is the target object's slug. If the body already contains internal links, copy the path pattern they use instead, since it reflects how the site is actually routed.
7. At most 3 links per object, at most one link per target per object, and never link an object to itself.
8. Skip any phrase that is already linked. Skip the object entirely if you would be adding a link to a page that already links back in the same paragraph.
9. Write the change with update_object, sending only the body field.

When finished, create one object in the link-report type recording:
- run_date: today
- objects_updated: how many objects you changed
- links_added: how many anchors you added in total
- summary: a markdown list with one line per anchor, in the form "source-slug: \"anchor text\" to target-slug"
- details: JSON array of { source_slug, anchor_text, target_slug }

Every edit creates a revision, so a human can revert an individual object from its revision history if they disagree with a link. Name every anchor in the summary so that review is possible without opening each page. If you found no genuine opportunities, create the report with zero changes rather than forcing links.
```

## Reviewing a run

The agent only wraps text that is already in the body, and the report names every anchor in the form `source-slug: "anchor text" to target-slug`. Every edit writes a revision, so an individual object can be reverted from its revision history without undoing the rest of the run. Start with the default of 5 objects per run before raising it.

## Cost

The pass reads each candidate body plus its search results, so cost scales with objects per run rather than with links added.

## Install

Open https://app.cosmicjs.com/login?redirect_to=%2Fprojects%3Fworkflow_template%3Dinternal-link-pass&utm_source=cosmicjs.com&utm_medium=website&utm_campaign=workflow-template-marketplace&utm_content=workflow-template-internal-link-pass , pick a project, and confirm. The workflow runs once immediately so its first result is visible right away.
