summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-07-17 10:21:51 +0800
committerEltrac <hi@guhub.cn>2025-07-17 10:21:51 +0800
commit0e1ff20e27a5fc427c74717d16bebbe7d774479d (patch)
tree8520e72118ee8a57b149813290ac29ba795800f7 /layouts
parent605463f98caeb2ea7a82b207aa5389292b5d5323 (diff)
refactor: remove img shortcode and enable markdown attribuets
Former-commit-id: b01c58d9bb80f117d1181eb1d3b0b126ed0e7b44
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_markup/render-image.html22
-rw-r--r--layouts/_shortcodes/img.html25
2 files changed, 12 insertions, 35 deletions
diff --git a/layouts/_markup/render-image.html b/layouts/_markup/render-image.html
index 21e574af..e2fbfd7f 100644
--- a/layouts/_markup/render-image.html
+++ b/layouts/_markup/render-image.html
@@ -1,16 +1,18 @@
{{- $src := .Destination -}}
{{- $alt := .Text | default "" -}}
{{- $caption := .Title | default "" -}}
-<a href="{{ $src }}" data-fancybox data-caption="{{ $caption }}" class="fancybox-link">
- <figure>
+{{- $class := .Attributes.class | default "" -}}
+
+<figure>
+ <a href="{{ $src }}" data-fancybox data-caption="{{ $caption }}" class="fancybox-link">
<img
- class="lazy" loading="lazy"
+ class="lazy {{ $class }}" loading="lazy"
src="{{ $src }}" alt="{{ $alt }}"
/>
- {{- if $caption }}
- <figcaption>
- <h4>{{ $caption | markdownify }}</h4>
- </figcaption>
- {{- end }}
- </figure>
-</a>
+ </a>
+ {{- if $caption }}
+ <figcaption>
+ <h4>{{ $caption | markdownify }}</h4>
+ </figcaption>
+ {{- end }}
+</figure>
diff --git a/layouts/_shortcodes/img.html b/layouts/_shortcodes/img.html
deleted file mode 100644
index 01d0684b..00000000
--- a/layouts/_shortcodes/img.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!-- image -->
-<figure {{ with .Get "class" }}class="{{ . }}"{{ end }}>
-{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
- <a href="{{ .Get "src" }}" data-fancybox {{ if isset .Params "title" }} data-caption="{{.Get "title" }}" {{ end }}>
- <img
- class="lazy"
- loading="lazy"
- src="{{ .Get "src" }}"
- {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" }}{{ end }}"{{ end }}
- />
- </a>
- {{ if .Get "link" }}</a>{{ end }}
- {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr") }}
- <figcaption>{{ if isset .Params "title" }}
- <h4>{{ .Get "title" | markdownify }}</h4>{{ end }}
- {{ if or (.Get "caption") (.Get "attr") }}<p>
- {{ .Get "caption" }}
- {{ with .Get "attrlink" }}<a href="{{ . }}"> {{ end }}
- {{ .Get "attr" }}
- {{ if .Get "attrlink" }}</a> {{ end }}
- </p> {{ end }}
- </figcaption>
-{{ end }}
-</figure>
-<!-- image -->