forked from jeremyf/takeonrules-hugo-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
maincolumn.html
22 lines (22 loc) · 1.48 KB
/
maincolumn.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{{- $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 itemprop="image" itemscope itemtype="http://schema.org/ImageObject" {{ if (or (isSet .Params "hidden") (eq (len $alt) 0)) }} aria-hidden="true"{{ end }}>
{{- with $caption }}<figcaption itemprop="caption">{{ partial "unparagraphy.html" . }}</figcaption>{{ end }}
{{- if .Get "link" }}
<a itemprop="isBasedOn" href="{{ $original.RelPermalink }}">
<img itemprop="url" 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 }}
<link itemprop="url" href="{{ $result.RelPermalink }}" />
<link itemprop="isBasedOn" href="{{ $original.RelPermalink }}">
<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 }}