forked from jeremyf/takeonrules-hugo-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarginfigure.html
20 lines (20 loc) · 1.08 KB
/
marginfigure.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{{- $path := .Get "src" }}
{{- $original := resources.Get $path }}
{{- $alt := default "" (.Get "alt") }}
{{- $imageResize := default "360x" (.Get "resize") }}
{{- with .Get "rotate" }}{{- $imageResize = (printf "%s r%s" $imageResize .) }}{{- end }}
{{- $result := $original.Resize $imageResize }}
<figure itemprop="image" itemscope itemtype="http://schema.org/ImageObject" {{ if (or (isSet .Params "hidden") (eq (len $alt) 0)) }}aria-hidden="true" {{ end }} role="note">
<link itemprop="url" href="{{ $result.RelPermalink }}" />
<img src="{{ $result.RelPermalink }}"
alt="{{ $alt }}"
width="{{ $result.Width }}"
height="{{ $result.Height }}"
{{- with .Get "title" }}title="{{ . }}"{{ end }}
data-original-url="{{ $original.RelPermalink}}"
data-original-width="{{ $original.Width }}"
data-original-height="{{ $original.Height }}"
data-width="{{ $result.Width }}"
data-height="{{ $result.Height }}" />
{{ with .Get "caption" }}<figcaption itemprop="caption">{{ partial "unparagraphy.html" . }}</figcaption>{{ end }}
</figure>