Automate SEO Internal Linking Across Your Site with n8n
Build an n8n internal linking automation that crawls your sitemap, finds orphan pages, suggests anchor-and-target links with AI, and gates edits for review.
Internal linking is one of the highest-ROI on-page SEO levers, and it's the one that rots fastest. Every new post should link to relevant older ones and earn links back, but nobody remembers the forty existing posts well enough to do it by hand. So new content lands orphaned, old content stops getting link equity, and the site's topical structure quietly decays. An n8n internal linking automation keeps it maintained: crawl the site, find the gaps, suggest the links, and let a human approve.
What ranks for this query is thin. A premium-gated community post with no node detail. A link extractor that finds links but suggests none. Hyperlinks baked into a writer agent that only helps brand-new posts. None of them crawl an existing sitemap, suggest anchors for published pages, and write back. That's the workflow below.
What internal-link automation handles
The job is bigger than inserting one link:
- A crawled index of every page and its topic
- A link graph showing what currently points where
- Orphan-page detection for pages nothing links to
- AI-suggested anchor text and target pages per post
- A review sheet before any edit touches the CMS
- A write-back step that inserts approved links
Run it on the content you maintain. Crawling pages you'll never edit just builds a map you don't act on.
The internal-linking pipeline
Schedule trigger → Crawl sitemap → Build page index + link graph
→ Detect orphans → AI suggests links → Review sheet → CMS write-back
A Schedule trigger kicks it off. The workflow crawls the sitemap, builds an index and a link graph, flags orphans, asks an LLM for relevant links per page, writes suggestions to a sheet, and only writes back to the CMS after approval.
1. Crawl the sitemap
Start from sitemap.xml. An HTTP Request node fetches it, a Code node parses the URLs, and a loop fetches each page. Use the HTML Extract node to pull the title, the main content text, and the existing internal links per page. Be polite, add a Wait node between fetches so you don't hammer your own server, and respect the Webhook node's 120-second default timeout by keeping per-page work light.
2. Build the index and the link graph
Store two things in Sheets: a page index (URL, title, topic summary) and a link graph (source URL to target URL for every existing internal link). The topic summary is worth generating once with an LLM, it's what makes later suggestions land on genuinely related pages instead of keyword-matched ones.
3. Detect orphans
Compare the link graph against the full URL list. Any page that appears as a target zero times is an orphan, no other page links to it, so search engines and readers struggle to find it. Flag these first; they're the highest-value fixes.
The naive version greps each post for a keyword and links it to whatever page mentions the same word. That produces links between pages that share a word but not a topic, which reads as spam and helps nothing. Build a topic summary per page first, then ask the LLM to suggest targets by topical relevance, not string match. A post about webhook security should link to the auth-setup guide even if neither shares an exact phrase. The index is the upfront cost; relevant suggestions are the payoff.
4. Suggest anchors with the LLM
For each page, pass its content plus the candidate target pages (title and topic summary) to an OpenAI node. Ask for two or three suggestions, each with a target URL, proposed anchor text, and a one-line reason. Cap it, a post stuffed with twelve internal links looks worse than one with three good ones. Parse the JSON response in a Code node before writing it anywhere.
5. Review, then write back
Write every suggestion to a review sheet: source page, target URL, anchor text, reason, status. An editor approves or rejects. Only approved rows hit the CMS write-back, an HTTP Request or the WordPress node that inserts the link into the post body. Auto-inserting links produces clumsy anchors and links to weak pages, so the gate earns its place.
Implementation patterns worth copying
Pattern: incremental crawls, not full re-runs
A full-site crawl every night is wasteful and rude to your server. Store a last-crawled timestamp per page and only re-crawl pages changed since, plus any new sitemap entries. The Content Scheduler & Distributor uses the same Sheet-driven state pattern, acting on what changed instead of reprocessing everything each run.
Pattern: link new posts both ways
When a new post publishes, do two passes: suggest outbound links from the new post to relevant old ones, and suggest inbound links from old posts to the new one. The second pass is what rescues new content from orphan status on day one, and it's the half most manual linking forgets.
Pattern: cap links per page and per target
Track how many internal links each target already has. Spread equity instead of piling every suggestion onto the same three popular pages. A simple count in the link graph drives this, skip a target once it's well-linked. The reverse matters too: a source page with twenty internal links dilutes every one of them, so cap outbound links per post and let the LLM pick the strongest few rather than every plausible match.
A word of caution before you point this at a live site. The CMS write-back edits published content, so a bad anchor or a wrong target ships straight to readers and search engines. Keep the review gate strict at first, log every edit with the old and new body so a rollback is a copy-paste, and run the write-back against a staging copy until the suggestions earn your trust. Internal linking is high ROI precisely because it touches real ranking pages, which is the same reason a careless edit costs more than the link is worth.
n8n nodes you'll use most
| Node | Purpose |
|---|---|
| HTTP Request | Fetches the sitemap and each page |
| HTML Extract | Pulls title, content, and existing links |
| Code | Builds the link graph and detects orphans |
| OpenAI | Summarizes topics and suggests anchor links |
| Google Sheets | Holds the index, link graph, and review queue |
| WordPress / HTTP Request | Writes approved links back to the CMS |
Getting started
- Point an HTTP Request node at your
sitemap.xmland parse the URLs. - Loop the pages with a Wait between fetches, extracting title, content, and links.
- Store a page index and a link graph in Google Sheets.
- Flag orphan pages that appear as a link target zero times.
- Ask an LLM for two or three topically relevant link suggestions per page.
- Write suggestions to a review sheet and let an editor approve.
- Write back only approved links, capping links per page and per target.
The Content Scheduler & Distributor ships the Sheet-driven engine this workflow runs on: it reads a queue from Google Sheets, filters what's due, processes each item with OpenAI, and tracks state so it acts on changes instead of reprocessing the whole list, the same crawl-state and review-queue backbone internal linking needs. It's part of The Complete n8n Templates Bundle, a one-time lifetime license to the whole catalog plus every template added later, worth it once you run more than one content automation.
For the content these links connect, turn a podcast into a blog post with n8n produces the new drafts that need inbound links on day one, and automate content translation with n8n shows the same crawl-and-write-back pattern applied to localized variants. When a freshly linked post needs a social push, the Social Media Scheduler & Designer generates the caption-and-graphic pair.
Compare content automation templates →Common questions
How do I automate internal linking with n8n?
Can n8n find orphan pages on my site?
Should internal-link edits be applied automatically?
Get the workflow templates this guide is built on
Import-ready n8n JSON, step-by-step setup, and tested end-to-end. One-time payment, own it forever.
Get 3 tested n8n templates, free
The full customer package for three real catalog templates — workflow JSON, step-by-step setup guide, credential checklist. Built through the same live-instance release process as everything we sell. Plus new templates and automation guides in your inbox. No spam, unsubscribe anytime.
- 01Smart To-Do List ManagerPre-built n8n workflow template that automates productivity with OpenAI. Live in about 10 minutes.$14
- 02Email Follow-Up AutomatorPre-built n8n workflow template that automates crm with OpenAI. Live in about 15 minutes.$12
- 03Market Trend AnalyzerPre-built n8n workflow template that automates data processing with OpenAI. Live in about 10 minutes.$14
More automation guides

Build a Self-Filling Content Calendar with n8n
Most content calendars die the same way: the planning sheet looks great in January, then a busy week leaves three empty slots, then a busier week leaves ten, and by March nobody trusts it. The fix isn…

Automate Content Translation and Localization with n8n
A blog that ranks in English is leaving traffic on the table in five other markets. The fix sounds simple, translate the posts, and the popular n8n template does exactly the naive version: title in, b…

Turn a Podcast into a Blog Post with n8n (Transcribe to Draft)
Every published episode is already a blog post, a set of show notes, and a week of social copy. It's just locked inside an hour of audio nobody has time to transcribe and rewrite. An n8n podcast to bl…