Skip to content

Instantly share code, notes, and snippets.

@awojtczyk
Created December 15, 2017 09:50
Show Gist options
  • Save awojtczyk/4c7d8f4a9f75d5a9342ef7af0c4cf7c6 to your computer and use it in GitHub Desktop.
Save awojtczyk/4c7d8f4a9f75d5a9342ef7af0c4cf7c6 to your computer and use it in GitHub Desktop.
search.json.liquid
{% layout none %}
{% capture results %}
{% for item in search.results %}
{% assign product = item %}
{
"title" : {{ product.title | json }},
"url" : {{ product.url | within: product.collections.last | json }},
"thumbnail": {{ product.featured_image.src | product_img_url: 'thumb' | json }}
}
{% unless forloop.last %},{% endunless %}
{% endfor %}
{% endcapture %}
{
"results_count": {{ search.results_count }},
"results": [{{ results }}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment