Tags
Learn about the powerful Statamic tags that come bundled.
- dok:outline
- dok:index_exists
- dok:theme:list
- dok:theme:default
- dok:theme:manifest
- The project tag
- The release tag
#dok:outline
Displays outline navigation generated from your markdown's headings, letting readers quickly jump between sections.
{{ dok:outline md="{content | raw}" }}
<a href="#{{ id }}">{{ text }}</a>
{{ if children }}
{{ children }}
<a href="#{{ id }}">{{ text }}</a>
...
{{ /children }}
{{ /if }}
{{ /dok:outline }}
| Parameter | Description | Required |
|---|---|---|
md |
The raw, unprocessed markdown you want the navigation to be based on. Eg. {{ markdown | raw }} |
✅ |
min |
The minimum number of headings before the component displays. |
#dok:index_exists
Checks whether a search index exists. Handy for hiding search on projects that don't have an index set up yet.
{{ if {dok:index_exists index="project-atlas"} }}
{{ partial:search/search_trigger }}
{{ /if }}
Or pass in a pipe separated array of index names. Returns true if any one of them is found.
{{ $indexes = [
['label' => 'Atlas', 'value' => 'project-atlas'],
['label' => 'Pulse', 'value' => 'project-pulse'],
] }}
{{ if {dok:index_exists :index="indexes | pluck('value') | piped"} }}
{{ partial:search/search_trigger }}
{{ /if }}
| Parameter | Description | Required |
|---|---|---|
index |
The index to look for. Takes a single name or a pipe separated list. Also available as indexes. |
✅ |
indexes |
Alias of index |
This checks your search config, not whether the index has actually been generated. An index you have configured but never run search:update on still counts as existing.
#dok:theme:list
Loops every theme defined in dok-themes.yaml.
{{ dok:theme:list }}
<p>{{ name }} ({{ id }}) - {{ appearance }}</p>
{{ /dok:theme:list }}
#dok:theme:default
Returns the default theme for a given appearance mode, as set in the default object in dok-themes.yaml.
{{ dok:theme:default mode="light" }}
{{ name }} ({{ id }})
{{ /dok:theme:default }}
<!-- Papyrus (papyrus) -->
{{ dok:theme:default mode="light" get="id" }}
<!-- papyrus -->
| Parameter | Description | Required |
|---|---|---|
mode |
Which default to fetch, light or dark. Defaults to dark. |
|
get |
Return a single field from the matched theme (id, name, or appearance). |
#dok:theme:manifest
Returns the entire theme manifest in dok-themes.yaml.
{{ dok:theme:manifest }}
{{ themes }}
{{ name }}, {{ id }}, {{ appearance }}
{{ /themes}}
{{ /dok:theme:manifest }}
#The project tag
The project tags give information about the project and its releases.
The project tags use the collection page variable, so you need to be on an entry route for them to work automatically. To use these tags outside an entry, you must use the collection parameter.
{{ project:versions collection="my_documentation" }}
If nested tags overwrite the collection variable, use the collection parameter to pass in the page scope collection.
{{ project:versions :collection="page:collection" }}
You shouldn't map the same collection to multiple releases. This tag finds the first release that contains the collection.
#project:entry
Gets the current project entry.
{{ project:entry }}
{{ title }}
{{ logo }}
<img src="{{ url }}" />
{{ /logo }}
{{ /project:entry }}
You can also pass a wildcard to grab specific data from the entry. This is just syntax sugar for grabbing a single piece of data without using the full tag pair.
{{ project:entry:title }}
{{ project:entry:logo }}
<img src="{{ url }}" />
{{ /project:entry:logo }}
#project:stable:entry
You can set a stable release in the project entry. This tag returns the entry you set.
{{ project:stable:entry }}
<p>The stable version is {{ version }}</p>
{{ /project:stable:entry }}
You can also pass a wildcard to grab specific data from the entry. This is just syntax sugar for grabbing a single piece of data without using the full tag pair.
Stable version is: {{ project:stable:entry:version }}
#project:stable:url
Returns the home URL for your stable release.
{{ project:stable:url }}
/docs/1.x
#project:versions
Gets all versions for the current project.
{{ project:versions }}
{{# Gets the version #}}
<p>{{ version }}</p>
{{# Gets the home URL #}}
<p>{{ url }}</p>
{{# Gets the label (beta, alpha, etc) #}}
<p>{{ label }}</p>
{{ /project:versions }}
An entry array is also available, giving you access to any data on that release entry.
{{ project:versions }}
{{ entry }}
{{ title }}
{{ /entry }}
{{ /project:versions }}
#project:versioned
Returns true or false depending on whether the project has more than one version.
{{ if {project:versioned} }}
Stuff to display if the project has more than one version
{{ /if }}
#The release tag
The release tags give information on the current release.
The release tags use the collection page variable, so you need to be on an entry route for them to work automatically. To use these tags outside an entry, you must use the collection parameter.
{{ release:version collection="my_documentation" }}
If nested tags overwrite the collection variable, use the collection parameter to pass in the page scope collection.
{{ release:version :collection="page:collection" }}
You shouldn't map the same collection to multiple releases. This tag finds the first release that contains the collection.
#release:entry
Gets the current release entry data.
{{ release:entry }}
{{ title }}
{{ version_navigation }}
{{ version }}
{{ show_outdated_banner }}
{{ github_repository_url }}
{{ github_edit_url }}
{{ /release:entry }}
You can also pass a wildcard to grab specific data from the entry. This is just syntax sugar for grabbing a single piece of data without using the full tag pair.
{{ release:entry:version }}
#release:nav:handle
Gets the handle for the release navigation.
{{ release:nav:handle }}
#release:version
Gets the version for the release.
{{ release:version }}
1.x
#release:outdated
Returns true or false depending on whether the release is outdated.
{{ if {release:outdated} }}
This will show if the current release is outdated.
{{ /if }}
This checks the show_outdated_banner field in your release entry.
#release:breadcrumbs
Returns an array of breadcrumbs based on the current release navigation.
{{ release:breadcrumbs }}
<span>
{{ title }}
{{ unless last }}
{{ svg src="arrow-right" aria-hidden="true" }}
{{ /unless }}
</span>
{{ /release:breadcrumbs }}
| Parameter | Description | Required |
|---|---|---|
prefix |
Prefix the breadcrumb list with a string of your choice. Eg Home |
|
prefix_single |
Uses the prefix only if there is one breadcrumb item. |