diff options
Diffstat (limited to 'themes/danix-xyz-hacker/layouts/shortcodes/image.html')
| -rw-r--r-- | themes/danix-xyz-hacker/layouts/shortcodes/image.html | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/themes/danix-xyz-hacker/layouts/shortcodes/image.html b/themes/danix-xyz-hacker/layouts/shortcodes/image.html index 0209b7e..84dec3f 100644 --- a/themes/danix-xyz-hacker/layouts/shortcodes/image.html +++ b/themes/danix-xyz-hacker/layouts/shortcodes/image.html @@ -1,22 +1,23 @@ {{- $src := .Get "src" -}} {{- $alt := .Get "alt" | default "Image" -}} {{- $caption := .Get "caption" -}} -{{- $class := .Get "class" | default "w-full h-auto rounded-lg border border-border/30" -}} +{{- $class := .Get "class" | default "w-full h-auto rounded-lg border border-border" -}} +{{- $link := .Get "link" -}} +{{- $figureClass := .Get "figure-class" -}} -{{- if $src -}} - <figure class="my-8"> - <img - src="{{ $src }}" - alt="{{ $alt }}" - class="{{ $class }}" - loading="lazy" - /> +{{- if or $src .Inner -}} + <figure class="my-8{{- with $figureClass }} {{ . }}{{- end -}}"> + {{- if .Inner -}} + {{- .Inner -}} + {{- else -}} + {{- if $link -}}<a href="{{ $link }}">{{- end -}} + <img src="{{ $src }}" alt="{{ $alt }}" class="{{ $class }}" loading="lazy" /> + {{- if $link -}}</a>{{- end -}} + {{- end -}} {{- if $caption -}} - <figcaption class="mt-3 text-center text-sm text-text-dim italic"> - {{ $caption }} - </figcaption> + <figcaption class="mt-3 text-center text-sm text-text-dim italic">{{ $caption }}</figcaption> {{- end -}} </figure> {{- else -}} - {{- errorf "image shortcode: 'src' parameter is required" -}} + {{- errorf "image shortcode: 'src' parameter or inner content is required" -}} {{- end -}} |
