Custom query that will fetch managed property value and show pages with similar values in a Hightlighted content WebPart

ChristianDias-SIL 96 Reputation points
2021-08-04T09:40:56.727+00:00

I've tagged/categorized all site pages in my SharePoint site and would like to add a highlighted content WebPart with a custom query that is able to check what values are in the managed property and then filter any site pages with those same values.

Example:
A site page containing highlighted content WebPart, with the value "Outlook" as one of its managed properties will show all site pages also containing "Outlook" as a value in their managed properties.

Currently, I only have a static way of setting this Query. I've mapped the crawl to a managed property and it works but I would like for it to be able to get the value first and then filter those pages automatically.

The below is the custom query I use.

RefinableString00: Outlook

Any ideas?

Thanks in advance

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,685 questions
{count} votes

Accepted answer
  1. ChristianDias-SIL 96 Reputation points
    2021-08-11T08:49:02.73+00:00

    Hi @CaseyYang-MSFT ,

    Thanks for your response.

    I was at an impasse where I could only input the value manually. By value, I meant a static value to search for in the query but what I was looking for was a more automatic approach as I wanted to create a Site Page template.

    I managed to figure out how to do this. Using PnP Modern Search Results WebPart and the following text query, {|RefinableString00:{Page.WikiCategory}}. It identifies the values in a managed property of the current page and queries pages with the same values of that managed property, WikiCategory.

    I created a template Site Page with the WebPart pre-configured so any time a page is created, tagged with a value in the managed property and published it will show automatically all pages that are "related content".

    Thanks,
    Christian Dias


1 additional answer

Sort by: Most helpful
  1. CaseyYang-MSFT 10,436 Reputation points
    2021-08-05T07:53:33.053+00:00

    Hi @ChristianDias-SIL ,

    What do you mean " a static way of setting this Query"?

    Per my research, when you use custom query Hightlighted content WebPart will list all pages that contain "Outlook".

    For Reference:
    https://support.microsoft.com/en-us/office/use-the-highlighted-content-web-part-e34199b0-ff1a-47fb-8f4d-dbcaed329efd


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.