Search by

johnhenry / matrix-block-anchor

johnhenry

Anchor links for Matrix blocks, built from the block ID or set by an editor, with a copy button on each.

Package info

github.com/john-henry/matrix-block-anchor

Documentation

Type:craft-plugin

pkg:composer/johnhenry/matrix-block-anchor

Fund package maintenance!

john-henry

Buy Me A Coffee

Statistics

Installs: 45

Dependents: 1

Suggesters: 0

Stars: 1

Open Issues: 0

3.4.0 2026-09-28 20:04 UTC

README

Stable Version Static Badge

Matrix Block Anchor for Craft CMS

Matrix Block Anchor for Craft CMS

Matrix Block Anchor gives your editors anchor links straight to Matrix blocks. It builds each anchor from the block's ID and puts a copy button beside it. A developer adds the anchor to the block's template once, and from then on editors look after the rest themselves.

Features

  • Automatic Anchor Generation: Builds each block's anchor from its ID, so there's nothing for editors to set up
  • Custom Anchor Support: Let editors set their own readable anchors (#about-us, #pricing-section) instead of the auto-generated ones
  • Moving Blocks: An anchor comes from the block itself, not where it sits on the page, so you can move blocks around without breaking links
  • Configurable Prefix: Change the anchor prefix (blockIdAnchor by default) to whatever suits your own conventions
  • Validation Built-in: Anchor IDs must start with a letter, contain only valid characters, and stay unique within an entry
  • Easy Integration: Add the field to any Matrix block type and output it once in the block's template
  • Copy to Clipboard: One click and the link's on the clipboard, ready to paste wherever it's needed
  • Legacy Support: A setting for anyone upgrading from an older version, so your existing links don't break

Perfect For

  • Matrix-based page builders
  • Long-form content with a table of contents
  • Single-page sites with section navigation
  • Documentation and help centres
  • Landing pages with anchor-based navigation

Documentation

Full documentation is at johnhenry.ie/plugins/matrix-block-anchor/docs.

Requirements

  • Craft CMS 5.0 or later
  • PHP 8.2 or later

Accessibility

How accessible the plugin is, what's been checked, and how to report a problem are all in the accessibility statement.

Support

Need a hand? Open an issue on the GitHub Issues page.

License

This plugin is free to use under the MIT License.

John Henry - Craft CMS Plugins