return the alt tag to the img tag

This commit is contained in:
provos 2023-01-18 00:17:06 +00:00
parent 1f2702d769
commit e383c36c52
2 changed files with 6 additions and 5 deletions

View File

@ -93,9 +93,10 @@ class StackGallery {
figure.appendChild(el);
/// Add figcaption if it exists
if (img.hasAttribute('alt')) {
const childImg = img.querySelector('img')
if (childImg.hasAttribute('alt')) {
const figcaption = document.createElement('figcaption');
figcaption.innerText = img.getAttribute('alt');
figcaption.innerText = childImg.getAttribute('alt');
figure.appendChild(figcaption);
}

View File

@ -24,9 +24,6 @@
class="gallery-image"
data-flex-grow="{{ div (mul $image.Width 100) $image.Height }}"
data-flex-basis="{{ div (mul $image.Width 240) $image.Height }}px"
{{ with $alt }}
alt="{{ . }}"
{{ end }}
{{ end }}
{{- end -}}
@ -59,6 +56,9 @@
{{ with $Srcset }}srcset="{{ . }}"{{ end }}
loading="lazy"
decoding="async"
{{ with $alt }}
alt="{{ . }}"
{{ end }}
>
</picture>