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

image.html « blocks « partials « layouts - github.com/asurbernardo/amperage.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2edccf363e2fda48124ebf2e4d1321b3a78ed3ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<figure class="figure {{ with .caption }}figure--with-caption{{ end }}">
    {{ with .caption }}
        <figcaption class="figure__caption">
            {{ . }}
        </figcaption>
    {{ end }}
    {{ $resource := resources.Get .src }}
    {{ with $resource }}
        {{ if in (slice "jpeg" "jpg" "png" "gif") $resource.MediaType.SubType }}
            <amp-img
                src="{{ .Permalink | absURL }}"
                srcset="{{ (.Resize "1200x").Permalink }} 1200w,
                    {{ (.Resize "900x").Permalink }} 900w,
                    {{ (.Resize "640x").Permalink }} 640w,
                    {{ (.Resize "480x").Permalink }} 480w,
                    {{ (.Resize "320x").Permalink }} 320w"
                width={{ with $.width }} "{{ . }}" {{ else }} {{ .Width }} {{ end }}
                height={{ with $.height }} "{{ . }}" {{ else }} {{ .Height }} {{ end }}
                layout={{ with $.layout }}"{{ . }}"{{else}}"responsive"{{ end }}
                {{ with $.alt }}alt="{{ . }}"{{ end }}
                class="figure__image {{ with $.class }}{{ . }}{{ end }} {{ with $.caption }}figure__image--with-caption{{ end }}">
            </amp-img>
        {{ else }}
                    FOO
            <amp-img
                src="{{ .Permalink | absURL }}"
                width={{ with $.width }} "{{ . }}" {{ else }} {{ .Width }} {{ end }}
                height={{ with $.height }} "{{ . }}" {{ else }} {{ .Height }} {{ end }}
                layout={{ with $.layout }}"{{ . }}"{{else}}"responsive"{{ end }}
                {{ with $.alt }}alt="{{ . }}"{{ end }}
                class="figure__image {{ with $.class }}{{ . }}{{ end }} {{ with $.caption }}figure__image--with-caption{{ end }}">
            </amp-img>
        {{ end }}
    {{ end }}
</figure>