Reputation: 6115
I have a list of articles in my data and one of the fields is a link to an image. I'm using jeykll-assets
, and I would like to load the images using the asset_path
. However, the following isn't working:
{% for article in site.data.press %}
<div class="press-item">
<div class="press-image">
<div class="centerit"></div>
<a href="{{ article.url }}" target="_blank">
<img src="{% asset_path article.logo %}" />
</a>
</div>
<div class="press-excerpt">
<a href="{{ article.url }}" target="_blank">
<p>{{ article.title }}</p>
</a>
</div>
<div class="date">{{ article.date }}</div>
</div>
{% endfor %}
Specifically <img src="{% asset_path article.logo %}" />
because it doesn't load article.logo dynamically. What's the correct way to do this?
Upvotes: 0
Views: 514
Reputation: 52829
Use brackets like this : <img src="{% asset_path {{ article.logo }} %}" />
See https://github.com/jekyll/jekyll-assets#liquid-variables
Upvotes: 2