diff --git a/blog/scripts/utils.js b/blog/scripts/utils.js index 1ae323e..022d5a1 100644 --- a/blog/scripts/utils.js +++ b/blog/scripts/utils.js @@ -69,10 +69,9 @@ function getImageCaption(picture) { // If the parent element doesn't have a caption, check if the next sibling does const parentSiblingEl = parentEl.nextElementSibling; - if (!parentSiblingEl || !parentSiblingEl.querySelector('picture')) return undefined; + if (!parentSiblingEl || !parentSiblingEl.querySelector('picture')) return ''; const firstChildEl = parentSiblingEl.firstChild; - caption = firstChildEl?.tagName === 'EM' ? firstChildEl : undefined; - return caption; + if (firstChildEl?.tagName === 'EM') return firstChildEl; } async function buildArticleHeader(el) {