Pass a query variable to modern search page

Iron Contributor

We have a custom landing page that we created for our Office 365 site.  It uses the classic view and web parts.  We have a search box web part that we use to send the query to a custom search results page.  This custom search results page is only returning sites, groups, and blogs.  Works fairly well, except it doesn't return private groups that the user is a member of.  This may be a limitation that won't be fixed for the classic search.

 

As an alternative, I thought maybe I could pass the query to the modern search page 

https://tenant.sharepoint.com/_layouts/15/sharepoint.aspx?q={query}&v=search

 

I can't seem to figure out how to pass the value of the query box.  I've tried {SearchQueryBox}, {SearchTerms}, {QueryString}, nothing seems to work.  It doesn't subsitute the variable, it just puts the literal {Text} into the search results.

 

When it goes to the page, it automatically passes &k=<search term>, but k isn't recognized by modern view, it is looking for q.  {urlcontext} variable works, but that doens't help me.

 

Any ideas?

0 Replies