4

Is it possible to mark a page as hidden from search results in SXA 1.8 Sitecore 9.0.2?

I have a scope defined where the particular page template is allowed but there are exceptions when I would like to forbid a few of the pages from appearing in the search results. Can this be done without changing the scope itself? From Authors perspective ideally this would be just a checkbox on the page, but I am happy to consider other options.

What is the easiest way to achieve this?

1 Answer 1

6

Scope

The easiest/fastest way is via scope

enter image description here but I see you don't want it.

Searchable - modification

There is a computed field in SXA named searchable. Based on a base template it adds a field to the index of type bool. So later SXA can determine whether an item should be searchable or not.

You could extend it and include an additional check (based on a checkbox)

New index field - exclude from search checkbox

Similar to previous but this doesn't require direct SXA modification but you will have to create your own field.

Create a separate computed field (similar to Searchable) and store information from your checkbox.

Don't forget to use it in your scope.

Different template - not Searchable

It is not convenient but you could have a separate Page template for excluded pages and make sure that it does not contain Searchable base template

Summary

For single pages, I would use 1st. If you want to let people control that I would go with 3rd.

2
  • Hi, may I ask about Scope? I have a parent item and 10 children, I want to hide the parent item only but show the 10 children, is that possible?
    – Reena
    Commented Nov 23, 2021 at 15:09
  • 1
    yes, I believe solution is included in my answer. Commented Nov 24, 2021 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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