Making the img template a little smarter

This commit is contained in:
Jocelyn Badgley (Twipped) 2020-05-03 18:40:20 -07:00
parent dd03907917
commit 37e2950a7a

View File

@ -1,7 +1,7 @@
{{#if sizes}}
<div class="{{className}}" {{#if style}}style="{{style}}"{{/if}} target="_break"> <div class="{{className}}" {{#if style}}style="{{style}}"{{/if}} target="_break">
<a href="{{#if link}}{{link}}{{else}}{{rev (lookup (last sizes) 'url')}}{{/if}}" class="lb"><img <a href="{{#if link}}{{link}}{{else}}{{rev (lookup (last sizes) 'url')}}{{/if}}" class="lb"><img
src="{{rev sizes.0.url}}" src="{{rev url}}"
alt="{{alt}}" alt="{{alt}}"
srcset="{{#join sizes}}{{rev url}} {{width}}w{{/join}}" srcset="{{#join sizes}}{{rev url}} {{width}}w{{/join}}"
sizes="{{#if srcSizes}}{{srcSizes}}{{else}}(max-width: 576px) 100vw, 576px{{/if}}" sizes="{{#if srcSizes}}{{srcSizes}}{{else}}(max-width: 576px) 100vw, 576px{{/if}}"
@ -11,3 +11,4 @@
{{#if caption}}<span class="card-body">{{{caption}}}</span>{{/if}} {{#if caption}}<span class="card-body">{{{caption}}}</span>{{/if}}
</div> </div>
{{/if}}