statamic/wikilinks
Add wiki-style [[links]] to Statamic content. Write double-bracket references and Wikilinks resolves them to matching entries, supports custom display text, handles missing pages gracefully, and can surface backlinks. Simple, fast, and easy to configure.
statamic/wikilinks is a Statamic addon that lets content editors write wiki-style [[Entry Title]] links inside Markdown-ish content and have them resolved to real entry URLs at render time.
Version note for 2.2.0: this release's only change is Statamic 6 support. The Composer constraint on statamic/cms was widened (v5 and v6), so:
statamic/wikilinks:^2.2 — earlier 2.x tags will not resolve.statamic/cms so Composer can solve the dependency graph in one pass.composer require statamic/wikilinks:^2.2
php artisan vendor:publish --tag=wikilinks-config # if a config is published
Where to look first:
config/wikilinks.php (if published) — the resolution strategy, link target field, and broken-link behaviour all live here.vendor/statamic/wikilinks/src — the resolver class is small; read it before assuming how titles are matched.First use case: create a Markdown field on a collection, add [[My Other Entry]] to a value, save, and view the rendered page. If you see a link, the addon is wired correctly; if you see literal brackets, jump to the Gotchas section.
Editor workflow (the primary use case). Wikilinks are authoring sugar: writers type entry titles, the addon turns them into links without needing the entry's URL. Keep the raw [[...]] text in the stored value — do not pre-process on save. Resolution at render time means renaming an entry's slug silently fixes every inbound link, which is the whole point of the package.
Where to apply it. Restrict wikilink parsing to fields that genuinely need it (a body Markdown field, a Bard set marked as Markdown). Blanket-enabling it across every text field usually produces surprising linkification in summaries, meta descriptions, and SEO fields.
Bard integration. If your Bard sets render Markdown, the addon's transform runs in the same pipeline. Confirm the order: wikilinks must resolve before the Markdown parser converts to HTML, otherwise the brackets arrive already wrapped in a <p> and may not match. Test with a Bard entry that has two adjacent wikilinks.
Antlers/Blade templates. Treat the field like any other Markdown field — {{ body }} in Antlers, {!! $entry->body !!} in Blade. The addon typically augments the fieldtype's rendered value rather than the raw value, so $entry->raw('body') still shows the literal brackets, which is handy for a "what links here" feature.
Programmatic resolution. For sitemaps, exports, or backlink indexes, resolve links outside the template layer by instantiating the resolver against a string and inspecting the matches. This is the cleanest way to build a "referenced by" index without parsing stored content yourself.
Testing. Wikilink behaviour is content-dependent, so write one feature test per rendering path (Markdown field, Bard field, and any custom fieldtype you've extended) and assert on the resulting href, not on the raw string. When you bump to 2.2.0, those tests are your compatibility check — Statamic 6 rewrote parts of the Markdown rendering pipeline, so a passing render test on v5 plus a passing render test on v6 is the only meaningful proof.
Custom resolution. If entry titles are not unique in your site, override the default resolver (via config or a bound implementation) to match on a dedicated wiki_key or slug field. Doing this before editors start using the syntax is far cheaper than cleaning up ambiguous links afterwards.
[[Changelog]] non-deterministic — usually first-match-wins in query order, which is not stable across publishes. Enforce unique titles on the target collection, or move to a slug/key-based resolver.[[my entry]] may not find "My Entry". Agree on a house style with editors, or normalise in a custom resolver.[[...]] visible (good — writers can see the gap) or strip it (bad — the text vanishes silently). Check the config default and set it deliberately. Add a scheduled check that greps stored content for unresolved links.php artisan commands frequently do not fire the events that clear it — run php artisan cache:clear / statamic:stache:clear after scripted imports.[[Title]] should resolve to the localised version of the entry. Verify on your second site: a link that resolves to the default-locale URL is a common and quiet bug, and it is not covered by Statamic 6 compatibility work.[[ (usually \[\[ or a code span) before they hit the problem in a draft.^5.0 will fail the whole Composer solve, and the error message points at this package rather than the real culprit.^2.2 in composer.json rather than a wildcard — a later 3.x may change the config schema, and wikilink config drift is invisible until content renders wrong.How can I help you explore Laravel packages today?