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

default.html « article-list « partials « layouts - github.com/CaiJimmy/hugo-theme-stack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ccbfba540ceadb49c6396e8cd1243b0658e42cb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{{ $image := partial "helper/image" (dict "Context" . "Type" "articleList") }}
<article class="{{ if $image.exists }}has-image{{ end }}">
    {{ if $image.exists }}
        <div class="article-image">
            <a href="{{ .Permalink }}">
                {{ if $image.resource }}
                    {{- $thumbnail := $image.resource.Fill "800x250" -}}
                    {{- $thumbnailRetina := $image.resource.Fill "1600x500" -}}

                    <img src="{{ $thumbnail.RelPermalink }}" 
                        srcset="{{ $thumbnail.RelPermalink }} 800w, {{ $thumbnailRetina.RelPermalink }} 1600w"
                        width="{{ $thumbnail.Width }}" height="{{ $thumbnail.Height }}" loading="lazy"
                        alt="Featured image of post {{ .Title }}" />
                {{ else }}
                    <img src="{{ $image.permalink }}" loading="lazy" alt="Featured image of post {{ .Title }}" />
                {{ end }}
            </a>
        </div>
    {{ end }}

    {{ partial "article/components/details" . }}
</article>