chrisvasey/statamic-backlinks
Statamic Backlinks is a lightweight addon for tracking inbound links to your Statamic content. Record, display, and manage backlinks from the control panel, making it easier to monitor referring sites and see which pages link to your entries. It helps you keep an eye on referral traffic and link sou...
This is a Statamic addon (Antlers tags, CP sidebar, please commands) that runs inside a Laravel app — so treat it as a Laravel package with a Statamic-shaped surface area. The install path is standard, but the value only shows up once the index exists.
composer require the addon, then publish its config: php artisan vendor:publish --tag="<addon>-config" (check php artisan vendor:publish output for the exact tag).[[...]] syntax, and the CSS class names for existing vs. missing links.[[Some Other Entry]] into an entry's markdown/textarea field, save, and render it through the modifier:{{ content | wiki_links }}
php please backlinks:rebuild
First real use case: a small internal knowledge base or docs collection where 10–50 entries cross-reference each other. That's the size where the missing-link styling (red-link behaviour, MediaWiki-style) is genuinely useful for spotting content gaps rather than just noise.
Rendering. The wiki_links modifier is the workhorse — every place you output a field that can contain wiki-links needs it. That means more than the main content field: teasers, search results, RSS feeds, meta descriptions. Grep your templates for the field handles you enabled and add the modifier deliberately rather than assuming it's global.
Order of modifiers matters. Decide whether wiki_links runs before or after your Markdown modifier, and be consistent across templates. Doing the conversion on raw text and then passing through Markdown is usually the safer order, since it keeps the anchor markup inside the Markdown parse rather than depending on your Markdown config allowing raw HTML through.
Backlinks tag. The backlinks Antlers tag is for anywhere other than the CP sidebar — related-content blocks, "referenced by" footers, entry-level SEO/sitemap context:
{{ backlinks }}
<a href="{{ url }}">{{ title }}</a>
{{ /backlinks }}
Wrap it in an emptiness check; most entries in a young site have zero backlinks and you don't want an empty <h3>Referenced by</h3> in the markup.
Page creation from missing links is the highest-leverage workflow here, and also the one that needs a policy decision. Authors can click a missing link and get a stub entry. Decide up front: which collection do stubs land in, what's their published state (draft is the sane default), and who is allowed to do it. If your content team is large, wire this to Statamic permissions rather than leaving it open to anyone with CP access — otherwise you get a sprawl of half-titled stubs.
Rebuild as a deployment step, not a request-time operation. The index is derived data, so treat backlinks:rebuild like a cache warm. Hook it into your deploy script (Envoyer/Forge deploy hooks, or a Laravel post-deploy command) and run it after content imports or bulk edits. If the collection is large, run it in a queue job or a scheduled task off-peak rather than blocking the deploy.
Widget. The dashboard widget is zero-config past registration — but if you have multiple user roles, remember dashboards are per-user-editable in Statamic, so "everyone sees backlink activity" is not automatic. Add it to the default dashboard config if you want it to be a shared signal rather than opt-in.
Theming. Point the configurable CSS classes at your existing design tokens instead of shipping the addon's defaults into a Tailwind build you'll then have to purge-match. Missing-link styling in particular should be visually distinct but not alarming — it's a to-do, not an error.
[[Page Title]] resolves against the entry's title, so a rename silently converts every inbound link into a missing link. That's the feature working as intended — but it means renames need a migration plan (alias/redirect entries, or sweep the referrers). Consider a naming convention or an internal style guide for titles so renames are rare.config:cache. This bites in production where the config was cached during deploy but the addon config was edited afterwards.|Display Text. The display-text half of [[Page Title|Display Text]] comes from content authors. Verify how the modifier emits it — if it's dropped into the anchor unescaped, you've handed authors an HTML injection vector. Test with a payload before you let non-technical users near it.id !== current id when you build related-content blocks manually.backlinks tag inside a collection listing is an N+1 shape — one lookup per entry. Fine for ten entries, not for a paginated 200-item index page. Either eager-load via the index or restrict the tag to single-entry templates.How can I help you explore Laravel packages today?