-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmaincolumn.html
20 lines (20 loc) · 1.23 KB
/
maincolumn.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{{- $path := .Get "src" }}
{{- $alt := default "" (.Get "alt") }}
{{- $caption := .Get "caption" }}
{{- $original := resources.Get $path }}
{{- if $original }}
{{- $title := .Get "title" }}
{{- $imageResize := default "770x" (.Get "resize") }}
{{- with .Get "rotate" }}{{- $imageResize = (printf "%s r%s" $imageResize .) }}{{- end }}
{{- $result := $original.Resize $imageResize }}
<figure {{ if (or (isSet .Params "hidden") (eq (len $alt) 0)) }} aria-hidden="true"{{ end }}>
{{- with $caption }}<figcaption>{{ partial "unparagraphy.html" . }}</figcaption>{{ end }}
{{- if .Get "link" }}
<a href="{{ $original.RelPermalink }}">
<img src="{{ $result.RelPermalink }}" alt="{{ $alt }}" data-original-url="{{ .Site.BaseURL | replaceRE "/$" "" }}{{ $path }}" width="{{ $result.Width }}" height="{{ $result.Height }}" data-width="{{ $result.Width }}" data-height="{{ $result.Height }}" />
</a>
{{- else }}
<img src="{{ $result.RelPermalink }}" alt="{{ $alt }}" {{ with .Get "title" }}title="{{ . }}" {{ end }}data-original-url="{{ .Site.BaseURL | replaceRE "/$" "" }}{{ $path }}" width="{{ $result.Width }}" height="{{ $result.Height }}" data-width="{{ $result.Width }}" data-height="{{ $result.Height }}" />
{{- end }}
</figure>
{{- end }}