visuellverstehen/statamic-anchor-navigation

A Statamic tag for creating an anchor nav for all headings generated by the bard editor.
12,149 5
Install
composer require visuellverstehen/statamic-anchor-navigation
Latest Version:v1.1.0
Laravel:12 · 13
License:MIT
Last Updated:Jun 10, 2026
Links: GitHub  ·  Packagist
Maintainer: visuellverstehen

Statamic Anchor Navigation

A Statamic addon that provides a custom tag for creating an anchor nav for all headings generated by the bard editor.

Features

  • Extends the TipTap heading node and adds a slugified ID to all configured heading levels (defaults to h2).
  • The {{ anchor_navigation }} tag makes it easy to build an anchor navigation for all headings within your bard content.

How to install

Run the following command from your project root:

composer require visuellverstehen/statamic-anchor-navigation

How to use

Include the {{ anchor_navigation }} tag in your template and supply the field handle of your bard field.

<ul>
    {{ anchor_navigation from="bard" }}
        <li>
            <a href="#{{ id }}">{{ headline }}</a>
        </li>
    {{ /anchor_navigation }}
</ul>

You also specify the entry from which you want to render the anchor navigation.

<ul>
    {{ anchor_navigation from="bard" :entry="specific_entry" }}
        <li>
            <a href="#{{ id }}">{{ headline }}</a>
        </li>
    {{ /anchor_navigation }}
</ul>

You can get the amount of headings found within the content with the count tag:

{{ if {anchor_navigation:count from="bard"} > 0 }}
    ...
{{ /if }}

Configurations

You can define which heading levels should be included in your anchor navigation. Level 2 headings are set as a default.

'heading' => [
    'levels' => [2],
],

More about us

License

The MIT license (MIT). Please take a look at the license file for more information.

Related Packages

visuellverstehen/statamic-classify

A useful helper to add CSS classes to all HTML tags generated by the bard editor...

125,334 20
visuellverstehen/statamic-picturesque

A Statamic tag for building HTML-only responsive images.

19,764 11
visuellverstehen/statamic-content-renderer

A Statamic search transformer for bard and replicator fields.

9,057 1
visuellverstehen/statamic-asset-atlas

Track where your Statamic assets are used to make moving, replacing and deleting...

38,639 1

Version History

Version Released License
v1.1.0 MIT
v1.0.0 MIT
Pre-releases (12)
Version Released PHP License
v0.3.6-beta ^8.1 MIT
v0.3.5-beta ^8.1 MIT
v0.3.4-beta ^8.1 MIT
v0.3.3-beta ^8.1 MIT
v0.3.2-beta ^8.1 MIT