1

We have an SXA Search box defined on a partial design in our Master Shared site. The problem is we need to have the SearchPageResults rendering parameter field use a query to pull the search results page relevant to the derived host site, but it seems that setting the SearchPageResults to a query value such as query:$home/search-results doesn't work. It doesn't resolve to the proper search results page when viewed from a derived site with the the search-results page existing in that specific place.

I've done some reading; I don't believe rendering parameters support Sitecore queries syntax with SXA tokens, or at least the SXA components don't from what I can tell. I was talking to some team members and they suggested I could set up the SXA Token pipelines to handle the Rendering Parameters for the component.

However, Googling and digging through Sitecore documentation has only gotten me so far. I would think the following configuration would work for what I'm trying to do:

    <pipelines>
      <getLookupSourceItems>
        <processor type="Sitecore.XA.Foundation.Multisite.Pipelines.ResolveTokens.ResolveMultisiteTokens, Sitecore.XA.Foundation.Multisite" resolve="true"/>
        <processor type="Sitecore.XA.Foundation.Presentation.Pipelines.ResolveTokens.ResolvePresentationTokens, Sitecore.XA.Foundation.Presentation" resolve="true" />
        <processor type="Sitecore.XA.Foundation.Theming.Pipelines.ResolveTokens.ResolveThemingTokens, Sitecore.XA.Foundation.Theming" resolve="true" />
        <processor type="Sitecore.XA.Foundation.TokenResolution.Pipelines.ResolveTokens.CurrentTemplateToken, Sitecore.XA.Foundation.TokenResolution" resolve="true" />
        <processor type="Sitecore.XA.Foundation.TokenResolution.Pipelines.ResolveTokens.EscapeQueryTokens, Sitecore.XA.Foundation.TokenResolution" resolve="true" />
      </getLookupSourceItems>
    </pipelines>

Any ideas on how I can get this to work? Am I on the right track? Perhaps there's a simpler way of accomplishing this that I'm not seeing.

UPDATE -

Looking at a note on the ticket, I see I may have left out some details. Let me try again.

I have my search box inside a partial design that is located in my shared site "Master". The search box component has a Rendering Parameter named SearchResultsPage, which points to the search results page it should redirect it's query to. I tried to pass the parameter "$home/search-results", which is where the page will be on every derived site of "Master", such as my derived site "QA."

The problem is, when I set this value on the partial design in "Master", it doesn't work on my derived site "QA". I'm not redirected to my relative search results page path from the QA site, I'm just taken to the same page with the fields relevant to the query updated past the hash. It would seem the relative path I set in the "Master" partial design isn't being resolved properly on the child "QA" site.

Note: the search-results page doesn't exist on "Master", so I don't expect this to work in the context of working with the "Master" site itself, such as editing the partial design in the "Master" site in Experience Editor. The issue I'm having is it's not resolving on my derived "QA" site.

Let me know if anything here isn't clear.

2
  • Sounds like you are not setting up the Scope Query properly. This scope is converted to a search that automatically scopes the results to the site. Commented May 12, 2020 at 22:20
  • @MichaelWest see the UPDATE section for further details. I don't believe it's the search scope that's the problem, it's that I can't seem to use a relative path with SXA tokens in a Rendering Parameter to have go to the proper search results page. Commented May 12, 2020 at 22:42

1 Answer 1

1

The solution I went with is outlined in the answer here, with some changes made on our end.

Displaying SXA Search Results on the separate page

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.