0

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?

2

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.

enter image description here

On the page template, inherit from the base template.

enter image description here

On each page that should be exclude, Content Authors can check the box.

enter image description here

In the scope query you can exclude results based on that checkbox.

enter image description here

  • Nice solution; I didn't know it could be done this way, it seems a bit cleaner than mine, cheers. – Jack Hayward Jun 17 '19 at 7:34
1

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 /sitecore/templates/Project/SiteName

Here's an example I recently created, this template inherits from Page and I've added a Checkbox field to it.

enter image description here

In the "Hide from dynamic navigation pod" template item, I've set the default value to 0.

enter image description here

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.

enter image description here

Now, when you tick the "Hide from dynamic navigation pod" box on any page, that page will not be included in any page lists.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.