xd0.de Platform Documentation
Imprint, Privacy Policy and Terms and Conditions
https://xd0.de/doc/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
1.2 KiB
25 lines
1.2 KiB
{{ if .Get "src" }}
|
|
{{ $original := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }}
|
|
{{ if .Get "fit"}}
|
|
{{ .Scratch.Set "image" ($original.Fit (.Get "fit")) }}
|
|
{{ else if .Get "resize"}}
|
|
{{ .Scratch.Set "image" ($original.Resize (.Get "resize")) }}
|
|
{{ else if .Get "fill"}}
|
|
{{ .Scratch.Set "image" ($original.Fill (.Get "fill")) }}
|
|
{{ else }}
|
|
{{ errorf "Invalid image processing command: Must be one of Fit, Fill or Resize."}}
|
|
{{ end }}
|
|
{{ $image := .Scratch.Get "image" }}
|
|
<figure class="{{ with .Get "position"}}{{ . }}{{ else -}} left {{- end }}" >
|
|
{{ with .Get "link"}}
|
|
<a href="{{ . }}">
|
|
{{ end }}
|
|
<img style="max-width: 100%; width: auto; height: auto;" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" {{ with .Get "alt" }} alt="{{ . | plainify }}" {{ end }} {{ with .Get "style" }} style="{{ . | safeCSS }}" {{ end }} />
|
|
{{ with .Get "link"}}
|
|
</a>
|
|
{{ end }}
|
|
{{ if .Get "caption" }}
|
|
<figcaption class="{{ with .Get "captionPosition"}}{{ . }}{{ else -}} center {{- end }}" {{ with .Get "captionStyle" }} style="{{ . | safeCSS }}" {{ end }}>{{ .Get "caption" | safeHTML }}</figcaption>
|
|
{{ end }}
|
|
</figure>
|
|
{{ end }}
|
|
|