hugo-snotra/layouts/shortcodes/img.html

21 lines
569 B
HTML

{{ $img := $.Page.Resources.GetMatch (.Get "src")}}
{{ $test := $img.Permalink }}
{{ $name_splitted := split $img.RelPermalink "." }}
{{ $name_base := index $name_splitted 0 }}
<figure {{ with .Get "class" }} class="{{ . }}"{{ end }}>
{{ with .Get "link" }}
<a href="{{ . }}">
{{ end }}
<picture>
<source srcset="{{$img.RelPermalink}}" type="image/jpg">
<img src="{{ $img.RelPermalink }}" alt="{{.Get "alt" }}" />
</picture>
{{ with .Get "link" }}
</a>
{{ end }}
{{ with .Get "title" }}
<figcaption>
<p>{{ . }}</p>
</figcaption>
{{ end }}
</figure>