Difference between revisions of "Liquid Template Variables - search"
From Spiffy Stores Knowledge Base
m (→search.terms) |
m (→search.terms) |
||
| Line 26: | Line 26: | ||
The ''highlight'' filter can be used to apply a different style to any instances in the search results that match up with ''search.terms''. | The ''highlight'' filter can be used to apply a different style to any instances in the search results that match up with ''search.terms''. | ||
| + | |||
| + | <pre> | ||
| + | {{ item.content | highlight: search.terms }} | ||
| + | </pre> | ||
Revision as of 16:44, 11 March 2016
The Liquid template variable search has the following attributes:
search.performed
Returns true if a successful search was performed.
search.results
Returns an array of search results. The search items may be a
In addition to the standard attributes returned by the respective variables, an additional attribute object_type is supported to distiguish each of the search results.
search.results_count
Returns the number of results found.
search.terms
Returns the original string that was submitted for the search.
The highlight filter can be used to apply a different style to any instances in the search results that match up with search.terms.
{{ item.content | highlight: search.terms }}