I have a collection page in folder Books1, together with some child pages representing books:
title: Books1
content:
items: '@self.children'
layout: style1
The children are displayed using template display-one-book.html.twig.
I have a second folder Books2, which has a collection page for listing the books in folder Books1:
title: Books2
content:
items:
'@page': '/Books'
layout: style2
I want the book information to be rendered differently when approached via the menu item Books2.
As far as I can see the display template display-one-book.html.twig has to be used for both Books1 and Books2, but presumably it is possible to control the layout by passing a variable. I have therefore introduced the variable layout, as you can see, together with a test in the template:
{% if page.parent.header.layout == 'style1' %}
...
Unfortunately, I find that the variable layout is always set to 'style1', regardless of whether the approach is made via Books1 or Books2. I tried using {{ page.referrer.header.layout }} but that didn't seem to have a value.
Can you tell me please how can I arrange for Books2 to use a different layout?