diff options
Diffstat (limited to 'themes/danix-xyz-hacker/shortcodes/image.html')
| -rw-r--r-- | themes/danix-xyz-hacker/shortcodes/image.html | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/themes/danix-xyz-hacker/shortcodes/image.html b/themes/danix-xyz-hacker/shortcodes/image.html new file mode 100644 index 0000000..07a698d --- /dev/null +++ b/themes/danix-xyz-hacker/shortcodes/image.html @@ -0,0 +1,22 @@ +{{- $src := .Get "src" -}} +{{- $alt := .Get "alt" | default "Image" -}} +{{- $caption := .Get "caption" -}} +{{- $class := .Get "class" | default "rounded-lg border border-border/30" -}} + +{{- if $src -}} + <figure class="my-8"> + <img + src="{{ $src }}" + alt="{{ $alt }}" + class="{{ $class }} w-full h-auto" + loading="lazy" + /> + {{- if $caption -}} + <figcaption class="mt-3 text-center text-sm text-text-dim italic"> + {{ $caption }} + </figcaption> + {{- end -}} + </figure> +{{- else -}} + {{- errorf "image shortcode: 'src' parameter is required" -}} +{{- end -}} |
