Skip to content
Coding Script or NotebookGitHubFree

Link Blocks for WordPress: Related Posts, Topic Cards, Siblings and Mentions

ForInternal linkingContent audits

By Lazarina Stoy· Updated 5 Dec 2026

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 up
  • build_mentions.py: builds the mentions index on your computer through the WordPress REST API and saves it to post meta. Dry run by default
  • crawl_link_zones.py: crawls your sitemap and labels every internal link by where it sits, so you can compare before and after
  • SKILL.md: a Claude skill, so Claude can adapt the blocks to your theme with you

How to use it

  1. Fill in your topic cards in the plugin file, then upload it to wp-content/mu-plugins/ on a staging site.
  2. 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.
  3. Run crawl_link_zones.py on a few pages to record where your links sit today.
  4. Run build_mentions.py as a dry run, read mentions_preview.csv, add aliases where it is noisy, then save it with --apply and an application password.
  5. 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