Search code examples
jekyllliquid

Prevent Jekyll from processing string


I have a Jekyll collection with frontmatter that includes:

image: https://placeimg.com/600/340/nature/1

When I try to inline that image url in a page like this:

<div style=background-image:url({{ img }})></div>

The content gets rendered like this:

<div class="product-banner" style="background-image:url(" https:="" placeimg.="" com="" 600="" 340="" nature="" 1)=""></div>

Does anyone know what I'm missing, or how I can get Jekyll to process this image properly?


Solution

  • I was missing the quotes around the attribute value, e.g.:

    <div style='background-image:url({{ img }})'></div>
    

    Mama mia.