When I use the {{ site.url }}
tag for an image path inside a variable in the front matter, it doesn't get translated into HTML.
The following works perfectly:
---
layout: post
title: chickpea
img: <img class="caption__media" data-interchange="[../asset/img/chickpea-small.jpg (small)], [../asset/img/chickpea-medium.jpg, (medium)], [../asset/img/chickpea-large.jpg, (large)]">
---
This does NOT work:
---
layout: post
title: chickpea
img: <img class="caption__media" data-interchange="[{{site.url}}/asset/img/chickpea-small.jpg (small)], [{{site.url}}/asset/img/chickpea-medium.jpg, (medium)], [{{site.url}}/asset/img/chickpea-large.jpg, (large)]">
---
But when I use the same image link with the {{site.url}}
tag inside a post and not as a variable, it works.
Analysing the generated site shows that Jekyll doesn't convert the {{site.url}}
tag when I use it in the image variable defined in the front matter.
So the question is: How can I get Jekyll to translate the image path in the YAML front matter correctly?