1
0
mirror of https://github.com/Damillora/Yuika synced 2024-11-13 21:47:32 +00:00

feat: responsive post thumbnail images

This commit is contained in:
Damillora 2021-04-20 16:04:39 +07:00
parent 69d3041171
commit 8bf1119b0b

View File

@ -13,9 +13,14 @@ with a `no-image` class so we can style it accordingly.
<div>
<div class="post-card__image">
{{#if feature_image}}
<img src="{{img_url feature_image size='m'}}" alt="{{title}}">
<img srcset="{{img_url feature_image size=" s"}} 300w, {{img_url feature_image size="m" }} 600w,
{{img_url feature_image size="l" }} 1000w, {{img_url feature_image size="xl" }} 2000w"
sizes="(max-width: 1000px) 400px, 700px" src="{{img_url feature_image size=" m"}}" alt="{{title}}">
{{else}}
<img src="{{img_url @site.cover_image size='m'}}" alt="{{title}}">
<img srcset="{{img_url @site.cover_image size=" s"}} 300w, {{img_url @site.cover_image size="m" }} 600w,
{{img_url @site.cover_image size="l" }} 1000w, {{img_url @site.cover_image size="xl" }} 2000w"
sizes="(max-width: 1000px) 400px, 700px" src="{{img_url @site.cover_image size=" m"}}"
alt="{{title}}">
{{/if}}
</div>
</div>