Skip to content

Instantly share code, notes, and snippets.

@epgarcia
Last active March 23, 2021 20:19
Show Gist options
  • Save epgarcia/90b1768b5713048ab4197351eeb709a1 to your computer and use it in GitHub Desktop.
Save epgarcia/90b1768b5713048ab4197351eeb709a1 to your computer and use it in GitHub Desktop.
Get BlogEntry image in ADT (FTL)
<#assign
blogEntry = assetRenderer.getAssetObject()
coverImageURL = blogEntry.getCoverImageURL(themeDisplay)
/>
<!-- Cover Image (as background). The div must have some dimensions -->
<#if validator.isNotNull(coverImageURL)>
<div class="cover-image-container" style="background-image: url(${coverImageURL})"></div>
</#if>
<!-- Cover Image (as image) -->
<#if validator.isNotNull(coverImageURL)>
<div class="asset-small-image">
<img alt="" class="asset-small-image img-thumbnail" src="${coverImageURL}" width="150" />
</div>
</#if>
<!-- Small Image -->
<#if blogEntry.isSmallImage()>
<div class="asset-small-image">
<img alt="" class="asset-small-image img-thumbnail" src="${htmlUtil.escape(blogEntry.getSmallImageURL(themeDisplay))}" width="150" />
</div>
</#if>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment