Link Blocks for WordPress: Related Posts, Topic Cards, Siblings and Mentions
Most internal linking advice is about links inside the text. Template blocks are the other half: a small piece of your theme that writes links by rule on every page of a type, including the posts you publish next year. These are the four blocks that run on mlforseo.com, rewritten so they work on any WordPress site.
Who it’s for
WordPress site owners and SEOs who want related content, topic cards and glossary mentions without another heavy plugin, and who are comfortable uploading one file to a staging site.
What’s in the folder
link-blocks.php: one must-use plugin with four shortcodes.[lb_related]shows posts from the same category,[lb_topic_card]one recommended page chosen by keyword rules,[lb_siblings]other items in the same term, and[lb_mentions]the pages where a term shows upbuild_mentions.py: builds the mentions index on your computer through the WordPress REST API and saves it to post meta. Dry run by defaultcrawl_link_zones.py: crawls your sitemap and labels every internal link by where it sits, so you can compare before and afterSKILL.md: a Claude skill, so Claude can adapt the blocks to your theme with you
How to use it
- Fill in your topic cards in the plugin file, then upload it to
wp-content/mu-plugins/on a staging site. - Place a block: in a block theme, add a Shortcode block to the Single Posts template; in a classic theme, one line in your child theme.
- Run
crawl_link_zones.pyon a few pages to record where your links sit today. - Run
build_mentions.pyas a dry run, readmentions_preview.csv, add aliases where it is noisy, then save it with--applyand an application password. - Crawl again. The block zones should appear, and the list of pages linked only from menus and footers should get shorter.
What you get
Links with descriptive anchors (every block uses the target’s title), cached lists that refresh when you edit a post, and a tiny stylesheet your theme can override. Mentions are matched on whole words, with acronyms and aliases handled, so “NER” never matches “partner”. The crawl labels make the change visible.
Limits
- It needs file access (FTP, SFTP or your host’s file manager) or a snippets plugin.
- Links added by a template never appear in the stored post, so only a crawl proves they are there.
- The mentions index is public through the REST API. It only holds public titles and links.
- Undo is three steps: remove the shortcodes, delete the file, purge your cache.
Read the wider approach in 10 Ways to Automate Internal Linking with AI. The AI-powered Internal Linking Audit and Automation course walks through the build and how it fits the rest of the linking pipeline.
What’s included
- One must-use plugin with four shortcodes: related posts, topic card, siblings and mentions
- build_mentions.py builds a "where this term shows up" index offline, dry run by default
- crawl_link_zones.py labels every internal link by where it sits: nav, footer, content or block
- A Claude skill so Claude can adapt the blocks to your site with you
- Unit tests, an undo section, and no tables or settings added
Where this resource is used on MLforSEO
Walkthroughs on the blog
Concepts behind it
More internal linking resources
- Coding Script or NotebookLink Menu to Linking Rules: Python Script for Auto-linking Plugins
- ChecklistBefore You Build: A Checklist for Internal Linking Tools
- Coding Script or NotebookInternal Linking QA and Holdout Group Notebook
- Visualization TemplateInternal Linking Impact Dashboard (Data Studio Template) with Setup Guide
- Coding Script or NotebookInternal Link Menu Notebook: Priority Score and Versioned Recommendations
- Coding Script or NotebookTopic Clustering Notebook for Internal Linking: BERTopic and K-means
See all 26 internal linking resources →See all 28 content audits resources →See all 73 coding script or notebook resources →
