aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/shortcodes/react.html
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default/layouts/shortcodes/react.html')
-rw-r--r--themes/default/layouts/shortcodes/react.html30
1 files changed, 30 insertions, 0 deletions
diff --git a/themes/default/layouts/shortcodes/react.html b/themes/default/layouts/shortcodes/react.html
new file mode 100644
index 0000000..ea96101
--- /dev/null
+++ b/themes/default/layouts/shortcodes/react.html
@@ -0,0 +1,30 @@
+{{- $text := default "react" (.Get "text" | default (.Get 0)) -}}
+{{- $source := default "" (.Get "source" | default (.Get 1)) -}}
+{{- $title := default $text (.Get "title" | default (.Get 2)) -}}
+{{- $alternate := default $title (.Get "alternate" | default (.Get 3)) -}}
+
+{{- $author := .Page.Section -}}
+
+{{- $image := partial "function-caches-images.html"
+ (dict
+ "Context" .Page
+ "Source" $source
+ "Fit" "100x100"
+ "Target" (print (partial "function-paths.html").media "/" $author "/")
+ "Copy" (print (partial "function-paths.html").media "/" $author "/react-" (path.Base $source))
+ "AlternateCopy" (print (partial "function-paths.html").media "/" $author "/react-" (path.BaseName $source) ".webp")
+ )
+-}}
+
+<tool-tip data-type="reaction" title="{{ $title }}">
+ {{ $text | markdownify }}
+ <a href="{{ $image.Permalink }}">
+ <img
+ width="{{ $image.Width }}"
+ height="{{ $image.Height }}"
+ title="{{ $title }}"
+ alt="{{ $alternate }}"
+ src="{{ $image.Permalink }}"
+ />
+ </a>
+</tool-tip>