mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-15 18:15:35 +00:00
feat: add ID to figures to make them linkable (#1475)
Generates linkable IDs for figures by anchorizing the caption and namespacing the figure ID by prefixing it with `figure-` to help prevent conflicts with other existing IDs.
This commit is contained in:
1 parent
90aca0659c
commit
f9794e9f09
1 file changed
+1
-1
@@ -18,7 +18,7 @@
|
|||||||
{{/* Get caption. Support legacy `title` option. */}}
|
{{/* Get caption. Support legacy `title` option. */}}
|
||||||
{{ $caption := .Get "title" | default (.Get "caption") | default "" }}
|
{{ $caption := .Get "title" | default (.Get "caption") | default "" }}
|
||||||
|
|
||||||
<figure{{ with .Get "class" }} class="{{.}}"{{ end }}>
|
<figure{{ with .Get "class" }} class="{{.}}"{{ end }} {{ with $caption }}id="figure-{{ anchorize . }}"{{ end }}>
|
||||||
|
|
||||||
{{ if $lightbox }}
|
{{ if $lightbox }}
|
||||||
<a data-fancybox="{{$group}}" href="{{$image_src}}" {{ with $caption }}data-caption="{{ .|markdownify|emojify }}"{{ end }}>
|
<a data-fancybox="{{$group}}" href="{{$image_src}}" {{ with $caption }}data-caption="{{ .|markdownify|emojify }}"{{ end }}>
|
||||||
|
|||||||
Reference in new issue
Block a user