johnhenry / matrix-block-anchor
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
Type:craft-plugin
pkg:composer/johnhenry/matrix-block-anchor
Requires
- php: ^8.2 || ^8.3 || ^8.4
- craftcms/cms: ^5.0
Requires (Dev)
- craftcms/ecs: dev-main
- craftcms/phpstan: dev-main
- phpstan/phpstan: ^2.2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-28 20:05:31 UTC
README
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 (
blockIdAnchorby 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.