Parent Tag

The Parent tag fetches data from the "parent" page — the URL one level above the current one. For example, the parent of this very URL (/tags/parent) is /tags, and the parent title is "Tags".

Overview

This is a simple utility tag that makes it easy to fetch data from the entry one page above the current entry. It's useful for creating section headers, simple breadcrumbs, and so on.

Parent URL

By itself the tag returns the parent's URL.

{{ parent }}
// Would return "/tags"
<s:parent />

Single Variables

You can fetch single variables from the parent entry by passing them as the second tag argument.

{{ parent:title }}
// Would return "Tags"
{{-- Using Antlers Blade Components --}}
<s:parent:title />
 
{{-- Using Fluent Tags --}}
{{ Statamic::tag('parent:title') }}

Tag Pair

As a tag pair, it will have access to all the parent's data:

{{ parent }}
Go back to <a href="{{ url }}">{{ title }}</a>.
{{ /parent }}
<s:parent>
Go back to <a href="{{ $url }}">{{ $title }}</a>.
</s:parent>
 
{{-- You also use "as" to alias the parent variable. --}}
<s:parent as="parent">
Go back to <a href="{{ $parent['url'] }}">{{ $parent['title'] }}</a>.
</s:parent>
Go back to <a href="/tags">Tags</a>.
Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →