2018-03-10 18:03:45 +01:00
|
|
|
{{ $type := index .Params "type" }}
|
|
|
|
|
|
|
|
<figure {{ if eq (.Get "size") "large" }}style="padding: 20px 0px;"{{ end }}>
|
|
|
|
{{ if eq $type "youtube" }}
|
|
|
|
{{/* copy pasted from hugo source code */}}
|
|
|
|
<div {{ if .Get "class" }}class="{{ .Get "class" }}"{{ else }}style="position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;"{{ end }}>
|
|
|
|
<iframe src="//www.youtube.com/embed/{{ .Get "id" }}?{{ with .Get "autoplay" }}{{ if eq . "true" }}autoplay=1{{ end }}{{ end }}"
|
|
|
|
{{ if not (.Get "class") }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" {{ end }}allowfullscreen frameborder="0" title="YouTube Video"></iframe>
|
|
|
|
</div>
|
|
|
|
{{ else }}
|
2023-02-03 08:13:01 +01:00
|
|
|
{{ $src := .Get "src" }}
|
|
|
|
{{ $split_src := split $src "." }}
|
|
|
|
{{ $extension := index $split_src (sub (len $split_src) 1) }}
|
|
|
|
{{- if eq $extension "png" -}}
|
|
|
|
{{ $originals := (.Page.Resources.ByType "image") }}
|
|
|
|
{{ $original := $originals.GetMatch (printf "*%s" (path.Base $src)) }}
|
|
|
|
{{ $resized_width := math.Min $original.Width 1024 }}
|
|
|
|
{{ $resized := $original.Resize (print $resized_width "x q90 jpg" ) }}
|
|
|
|
<img src="{{ $resized.Permalink }}" {{ with .Get "alt" }}alt="{{ . }}"{{ end }} />
|
|
|
|
{{- else -}}
|
|
|
|
<img src="{{ $src }}" {{ with .Get "alt" }}alt="{{ . }}"{{ end }} />
|
|
|
|
{{- end -}}
|
2018-03-10 18:03:45 +01:00
|
|
|
{{ end }}
|
2017-09-08 14:01:11 +02:00
|
|
|
{{ with .Get "title" }}
|
|
|
|
<figcaption>
|
|
|
|
<h4>
|
2019-08-17 22:50:53 +02:00
|
|
|
{{ . | markdownify }}
|
2017-09-08 14:01:11 +02:00
|
|
|
</h4>
|
|
|
|
</figcaption>
|
|
|
|
{{ end }}
|
|
|
|
</figure>
|