How can I inherit page properties
I have created a template based on a base page template and I have added one new property to a new template.
Now I want to inherit the new property to all the pages
I have created a template based on a base page template and I have added one new property to a new template.
Now I want to inherit the new property to all the pages
Hello @kunald36548265
As suggested by others in this thread, you can use the inheritedPageProperties.<your-property> in the sightly code to inherit <your-property> in child pages.
Use case where I've used inheritedPageProperties:
The requirement is to select a site section only on the top level page of a content tree and all pages underneath that page must use the same site section.
This requirement was achieved using inheritedPageProperties
A new property ( of type = select list) named "siteSection" is defined at the page template dialog. This select list has a predefined list of names of the various areas of the site. Along with that, the sightly code has the <meta name="" content=""> HTML HEAD attribute in on the page that looks for a property by the name "siteSection" on the current page.
If found on the current page, then it reads it and displays the value.
If not found, inheritedPageProperties climbs at its parent page and looks for a property by the name "siteSection". If found, reads it and displays it. If not, then repeats the process up in the page hierarchy until it finds a value to the property.
The marketing business team set the property only on handful of pages and the entire site had the attribute showing in no time.
<data-sly-test="${inheritedPageProperties.siteSection}"> <meta name="site_section" content="inheritedPageProperties.siteSection"> </sly>
regards,
Preetpal
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.