mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 18:15:31 +00:00
feat: re-add link option to figures
This commit is contained in:
1 parent
3f178a06f4
commit
b026701dd6
1 file changed
+8
@@ -9,6 +9,8 @@
|
||||
{{ $zoom := eq (.Get "lightbox" | default "true") "true" }}
|
||||
{{ $id := anchorize (.Get "id" | default ($caption | plainify)) }}
|
||||
{{ $alt := .Get "alt" | default ($caption | plainify) }}
|
||||
{{ $link := .Get "link" }}
|
||||
{{ $zoom = cond (ne $link "") false $zoom }}
|
||||
{{ $img_class := "" }}
|
||||
{{ if eq (.Get "theme" | lower) "light" }}{{ $img_class = printf "%s img-light" $img_class }}{{end}}
|
||||
{{ if eq (.Get "theme" | lower) "dark" }}{{ $img_class = printf "%s img-dark" $img_class }}{{end}}
|
||||
@@ -25,6 +27,9 @@
|
||||
<figure {{ with .Get "class" }}class="{{.}}"{{end}} {{ with $id }}id="figure-{{ . }}"{{ end }}>
|
||||
<div class="d-flex justify-content-center">
|
||||
<div class="w-100" {{ with .Get "max_width" }}style="max-width: {{.}}"{{end}}>
|
||||
{{- if $link -}}
|
||||
<a href="{{ $link }}" {{ if strings.HasPrefix $link "http" }} target="_blank" rel="noopener"{{ end }}>
|
||||
{{- end -}}
|
||||
{{- if $img -}}
|
||||
{{- $isSVG := eq $img.MediaType.SubType "svg" -}}
|
||||
{{- $isGIF := eq $img.MediaType.SubType "gif" -}}
|
||||
@@ -58,6 +63,9 @@
|
||||
{{- with .Get "width" }} width="{{.}}"{{end}} {{- with .Get "height" }} height="{{.}}"{{end}}
|
||||
{{- with $img_class }} class="{{.}}"{{end}} />
|
||||
{{- end -}}
|
||||
{{- if $link -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user