diff options
author | Jimmy Cai <github@jimmycai.com> | 2022-02-06 21:58:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-06 21:58:10 +0300 |
commit | 88beecd1017829346863d5d3f1f8fabe38843a30 (patch) | |
tree | 72e8d1e5f3ad0ae29b4abf7bbaae4a51f34547dc /layouts | |
parent | 67d5156507acdf66cc132d3a1d59f2bb92486c8f (diff) |
fix: hyperlinked image (#485)
* fix: hyperlinked image
closes https://github.com/CaiJimmy/hugo-theme-stack/issues/410
* feat: add support to inline images
* Remove unused code
* Remove data-alt-html
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/_markup/render-image.html | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 0325458..0ed5584 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -25,22 +25,17 @@ {{- end -}} {{- end -}} -<figure +<img src="{{ $Permalink }}" + {{ with $Width }}width="{{ . }}"{{ end }} + {{ with $Height }}height="{{ . }}"{{ end }} + {{ with $Srcset }}srcset="{{ . }}"{{ end }} + loading="lazy" + {{ with $alt }} + alt="{{ . }}" + {{ end }} {{ if $galleryImage }} class="gallery-image" - style=" - flex-grow: {{ div (mul $image.Width 100) $image.Height }}; - flex-basis: {{ div (mul $image.Width 240) $image.Height }}px" - {{ end }}> - <a href="{{ $Permalink }}" {{ if $galleryImage }}data-size="{{ $image.Width }}x{{ $image.Height }}"{{ end }}> - <img src="{{ $Permalink }}" - {{ with $Width }}width="{{ . }}"{{ end }} - {{ with $Height }}height="{{ . }}"{{ end }} - {{ with $Srcset }}srcset="{{ . }}"{{ end }} - loading="lazy" - {{ with $alt }}alt="{{ . }}"{{ end }}> - </a> - {{ with $alt }} - <figcaption>{{ . | markdownify }}</figcaption> + data-flex-grow="{{ div (mul $image.Width 100) $image.Height }}" + data-flex-basis="{{ div (mul $image.Width 240) $image.Height }}px" {{ end }} -</figure>
\ No newline at end of file +>
\ No newline at end of file |