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

render-image.html « _markup « _default « layouts - github.com/asurbernardo/amperage.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f574d0f1b6c7e9c4e50dff98f6f9d145a9a5dbf2 (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
36
37
38
39
40
41
42
43
44
45
46
<figure class="figure {{ with .Title }}figure--with-caption{{ end }}">
    {{ with .Title }}
        <figcaption class="figure__caption">
            {{ . }}
        </figcaption>
    {{ end }}
    {{ $resource := resources.Get .Destination }}
    {{ with $resource }}
        {{ if in (slice "jpeg" "jpg" "png") $resource.MediaType.SubType }}
            <amp-img
                src="{{ .Permalink | safeURL | absURL }}"
                srcset="{{ (.Resize "1200x").Permalink }} 1200w,
                    {{ (.Resize "900x").Permalink }} 900w,
                    {{ (.Resize "800x").Permalink }} 800w,
                    {{ (.Resize "640x").Permalink }} 640w,
                    {{ (.Resize "480x").Permalink }} 480w,
                    {{ (.Resize "320x").Permalink }} 320w
                "
                width="{{ .Width }}"
                height="{{ .Height }}"
                layout="responsive"
                alt="{{ $.Text }}"
                {{ with $.Title}} title="{{ . }}"{{ end }}
                class="figure__image {{ with $.Title }}figure__image--with-caption{{ end }}"></amp-img>
        {{ else if in (slice "gif") $resource.MediaType.SubType }}
            <amp-anim
                src="{{ .Permalink | safeURL | absURL }}"
                width="{{ .Width }}"
                height="{{ .Height }}"
                alt="{{ $.Text }}"
                layout="responsive"
                class="figure__image {{ with $.Title }}figure__image--with-caption{{ end }}"></amp-anim>
        {{ else if in (slice "svg") $resource.MediaType.SubType }}
            GoHugo resouces don't support svg images! ୧( ಠ Д ಠ )୨
        {{ end }}
    {{ else }}
        <amp-img
            src="{{ .Destination | safeURL | absURL }}"
            height="1"
            width="1"
            layout="responsive"
            alt="{{ .Text }}"
            {{ with .Title}} title="{{ . }}"{{ end }}
            class="figure__image {{ with .Title }}figure__image--with-caption{{ end }}"></amp-img>
    {{ end }}
</figure>