summaryrefslogtreecommitdiffstats
path: root/themes/danix-xyz-hacker/layouts/shortcodes/image.html
blob: 0209b7e6f40bc4f350994c827724d65f1ccb61ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{{- $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" -}}

{{- if $src -}}
  <figure class="my-8">
    <img
      src="{{ $src }}"
      alt="{{ $alt }}"
      class="{{ $class }}"
      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 -}}