Submit search via keywords and metadata in href


(Oliver Kass) #1

Hi folks,

 

Does anyone know if there is a way to submit a search page query via the use of keywords and metadata in an href?

 

I'm building a blog with categories added via metadata. These categories are being pulled through into the search page listings and I'm trying to figure out if there's a way to allow the user to pull up a search of all posts tagged with the same category by clicking on a category name in the listings.

 

So for example:

 

Blog post 1 - Category: <a href="%performs search on news category%">News</a> 

 

Blog post 2 - Category: <a href="%performs search on social category%">Social</a>

 

Thanks

 

Oli


(Peter McLeod) #2

Hi

 

The easiest way is to just do search on your category keyord and then copy the URL of the results page. You could probably leave out most of the parameter if you dont need them.

 

To supply a single parameter to the search page it would be something along the lines of:

//your-search-page-url?queries_yourfieldname_query=yoursearchterm

For example:

If serach page id is: 1234 and your serach field name is 'category'

<a href="%globals_asset_url:1234%?queries_category_query=social">Social</a> 

Thanks

Peter


(Oliver Kass) #3

Cheers Peter,

 

Thanks to your help I've got this working. Final keyword I ended up using to get it all up and running was:

 

%globals_asset_url:1234%?queries_blog_category_query=%asset_metadata_blog.category_key%

 

Magic

 

Oli