← hugo-clarity

Persist modified alt to image element (#408)

1d7940986aafdaa08e71e251fc1714dd88fda650 · Christos · Dec 19, 2022 11:53

Signed-off-by: Christos <987149+christosle@users.noreply.github.com>

Signed-off-by: Christos <987149+christosle@users.noreply.github.com>

+3 · 1 file changed

  • assets/js/index.js +3 −0
diff --git a/assets/js/index.js b/assets/js/index.js
index 66f7277..edfd26d 100644
--- a/assets/js/index.js
+++ b/assets/js/index.js
@@ -300,6 +300,9 @@ function fileClosure(){
         // Insert caption
         image.insertAdjacentHTML('afterend', desc.outerHTML);
       }
+
+      // Persist modified alt to image element
+      image.alt = alt
     });
 
     hljs.initHighlightingOnLoad();