d
Topic
Posts:
46
June 18, 2013

Liquid inside MetaFields This post is outdated

I am trying to create a second image slider inside a product page, that features the logos of blogs that posted about the specific product.

On product.liquid, i'm using something like:

<div class="quotes">
<blockquote>{{ product.metafields.quotes.one }}</blockquote>
<blockquote>{{ product.metafields.quotes.two }}</blockquote>
<blockquote>{{ product.metafields.quotes.three }}</blockquote>
</div>

When I edit the metafields and insert text as the string, it works. But when I try to retrieve an image using Liquid, it outputs it as plain text:

{{ 'globemail.png' | asset_url | img_tag }}

Any way to bypass it?

Ben Klinger, Studio Ve
i
Replies
Posts:
3768
Last edited June 18, 2013

Metafield resources are themselves strings or integers and not Liquid. To do your fancy processing, use JSON. Since JSON is a string that makes it useful as metafield values as per your keys. Super easy for you. Your slider is just Javascript anyway, so JSON is a natural food source for it. 

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
Posts:
46
June 18, 2013

Thanks for the reply.

I ended up adding the images with css.

<div class="imagefoo"></div>

 

Ben Klinger, Studio Ve