16 lines
1.0 KiB
HTML
16 lines
1.0 KiB
HTML
{{- /* Usage: {{< screenshot src="app/name.png" alt="…" caption="…" >}}. Images live in assets/screenshots/. Add demo="true" for screenshots taken on an upstream public demo rather than a Federated Core server. */ -}}
|
|
{{- $src := .Get "src" -}}
|
|
{{- with resources.Get (printf "screenshots/%s" $src) -}}
|
|
{{- $img := . -}}
|
|
{{- if gt .Width 1280 }}{{ $img = .Resize "1280x webp q82" }}{{ else }}{{ $img = .Process "webp q82" }}{{ end -}}
|
|
<figure class="screenshot">
|
|
<a href="{{ .RelPermalink }}"><img src="{{ $img.RelPermalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}" alt="{{ $.Get "alt" }}" loading="lazy" decoding="async"></a>
|
|
<figcaption>
|
|
{{- with $.Get "caption" }}{{ . | $.Page.RenderString }}{{ end -}}
|
|
{{- if eq ($.Get "demo") "true" }} <span class="screenshot-src">Shown on the public demo. Your server may look slightly different.</span>{{ end -}}
|
|
</figcaption>
|
|
</figure>
|
|
{{- else -}}
|
|
{{- errorf "screenshot: assets/screenshots/%s not found (%s)" $src $.Position -}}
|
|
{{- end -}}
|