Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Get parent page title from a modular template

Started by Muut Archive 11 years ago · 2 replies · 1385 views
11 years ago

I'm trying to figure out how to get the parent page title from one of the modular partials. So I have:

TXT
01.intro
   _header
      header.md
   _body
   modular.md

I want the header.md file to display the page title of the modular.md not the page title of itself. I currently have

TWIG
{% set patternTitle = page.title %}

set in the header.html.twig, but it only reads from itself (header.md) and not the parent (modular.md).

help?

11 years ago

It is just as you would expect it to be:

TWIG
{% set patternTitle = page.parent.title %}

:)

👍 1
11 years ago

Bah. You're right of course. I'm pretty sure that's the only thing I hadn't tried yet. Thanks for the nudge, Grav is my new goto now - love it. :)

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1338 9 years ago
Archive · by Muut Archive, 9 years ago
2 927 9 years ago
Archive · by Muut Archive, 9 years ago
2 4056 9 years ago
Archive · by Muut Archive, 9 years ago
1 2941 9 years ago
Archive · by Muut Archive, 9 years ago
3 1112 9 years ago