Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CaiJimmy/hugo-theme-stack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Cai <jimmehcai@gmail.com>2020-09-06 20:51:16 +0300
committerJimmy Cai <jimmehcai@gmail.com>2020-09-06 20:51:16 +0300
commit7f3d906f2478ae32ade9e5692ac458905d22ec9f (patch)
tree0fdd2f08c75a5ba49367141959cc41e7c709a1f3 /layouts/partials
parent2ab49f97ee8f95e14ed3ff0eafcc789a05920ec1 (diff)
feat(article list/default): better thumbnail
Diffstat (limited to 'layouts/partials')
-rw-r--r--layouts/partials/article-list/default.html10
1 files changed, 6 insertions, 4 deletions
diff --git a/layouts/partials/article-list/default.html b/layouts/partials/article-list/default.html
index e58ef18..25fcbc2 100644
--- a/layouts/partials/article-list/default.html
+++ b/layouts/partials/article-list/default.html
@@ -1,12 +1,14 @@
<article class="{{ if .Params.image }}has-image{{ end }}">
{{ if .Params.image }}
{{- $image := partial "helper/image" . -}}
- {{- $thumbnailNotDesktop := $image.Resize "x500 smart" -}}
-
+ {{- $thumbnail := $image.Fill "800x250" -}}
+ {{- $thumbnailRetina := $image.Fill "1600x500" -}}
+
<div class="article-image">
<a href="{{ .Permalink }}">
- <img src="{{ $thumbnailNotDesktop.RelPermalink }}"
- width="{{ $thumbnailNotDesktop.Width }}" height="{{ $thumbnailNotDesktop.Height }}" loading="lazy"
+ <img src="{{ $thumbnail.RelPermalink }}"
+ srcset="{{ $thumbnail.RelPermalink }} 1x, {{ $thumbnailRetina.RelPermalink }} 2x"
+ width="{{ $thumbnail.Width }}" height="{{ $thumbnail.Height }}" loading="lazy"
alt="Featured image of post {{ .Title }}" />
</a>
</div>