I have a requirement to render a list of child pages based on a parent item, I plan to use the page list component. One of the requirements asks for the ability to hide selected pages from the page list, how can I achieve this?
I would take an approach where you exclude items based on a field used by the search scope/item query.
Create a new base template which has a checkbox to exclude from index.
On the page template, inherit from the base template.
On each page that should be exclude, Content Authors can check the box.
In the scope query you can exclude results based on that checkbox.
This can be achieved by creating a new
Template that inherits from the
Page template and contains a
Checkbox field that you will use to define whether you wish the page to be displayed in the list or not. Page templates are created in
Here's an example I recently created, this template inherits from
Page and I've added a
Checkbox field to it.
In the "Hide from dynamic navigation pod" template item, I've set the default value to
Once your new
page template is complete, you'll now have to set a rule on each of the page list rendering variants in order to control when the page list is displayed.
The checkbox uses a value of
1 to determine
true so I defined the following rule on each rendering variant wrapper.
Now, when you tick the "Hide from dynamic navigation pod" box on any page, that page will not be included in any page lists.