summaryrefslogtreecommitdiff
path: root/layouts/shortcodes/yt.html
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/shortcodes/yt.html')
-rw-r--r--layouts/shortcodes/yt.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/layouts/shortcodes/yt.html b/layouts/shortcodes/yt.html
new file mode 100644
index 0000000..3c5837f
--- /dev/null
+++ b/layouts/shortcodes/yt.html
@@ -0,0 +1,22 @@
+{{- $id := .Get 0 }}
+{{- $title := .Inner }}
+{{- $path := printf "ytcovers/%s.jpg" $id}}
+{{- $img := resources.Get $path }}
+{{- $img1x := $img.Resize "x300 webp q90" }}
+{{- $img2x := $img.Resize "x600 webp q90" }}
+
+<figure>
+ <a href="https://www.youtube.com/watch?v={{$id}}" target="_blank">
+ <img
+ class="center"
+ src="{{ $img1x.Permalink }}"
+ srcset="
+ {{ $img1x.RelPermalink }} 1x,
+ {{ $img2x.RelPermalink }} 2x
+ "
+ width="{{ $img1x.Width }}"
+ height="{{ $img1x.Height }}"
+ alt="{{$title}} on Youtube"
+ >
+ </a>
+</figure>