2

Example I have a structure For all the subpages / child pages in the structure.

I want to access the title of its parent.

The result being that all the level 1 headers have the parent page title displayed as the header

All the children pages have the level 1 (parent page title) as the header

At the moment I am referencing entry.title

DumbDevGirl42069
  • 891
  • 5
  • 18
  • 47
  • @HardikSatasiya I guess not, I haven't used octobercms tbh, I've been told that it uses twig so I thought they would be similar! I'll update the tags ;-) – DumbDevGirl42069 Nov 23 '18 at 03:54

1 Answers1

3

You can access the parent in a struct via entry.parent in twig. For example:

{% if entry.parent %} 
  <h1>
    {{ entry.parent.title }}:<br>
    <small>{{ entry.title }}</small>
  </h1>
{% else %}
  <h1>{{  entry.title }}</h1>
{% endif %}
Jonathan Bennett
  • 1,055
  • 7
  • 14