From 41a910951bb7dd39e72e9f3247c7660eefe9a18f Mon Sep 17 00:00:00 2001
From: weru <onewesh@gmail.com>
Date: Fri, 20 Mar 2020 15:41:53 +0000
Subject: [PATCH] add shortcode
---
layouts/shortcodes/picture.html | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/layouts/shortcodes/picture.html b/layouts/shortcodes/picture.html
new file mode 100644
index 0000000..0949bb8
--- /dev/null
+++ b/layouts/shortcodes/picture.html
@@ -0,0 +1,9 @@
+{{- $normal := .Get 0 }}
+{{- $dark := .Get 1 }}
+{{- $alt := .Get 2 }}
+{{- $normalPath := absURL (printf "images/%s" $normal) }}
+{{- $darkPath := absURL (printf "images/%s" $dark) }}
+<picture class = 'nav_logo'>
+ <source srcset = '{{ $darkPath }}' media="(prefers-color-scheme: dark)">
+ <img srcset = '{{ $normalPath }}' alt = '{{ $alt }}'>
+</picture>
--
Gitblit v1.10.0