Skip to content

Commit

Permalink
pr
Browse files Browse the repository at this point in the history
  • Loading branch information
meganthecoder committed Sep 18, 2023
1 parent 33dd23e commit 1a6c028
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,9 @@ function getImageCaption(picture) {

// If the parent element doesn't have a caption, check if the next sibling does
const parentSiblingEl = parentEl.nextElementSibling;
caption = parentSiblingEl
&& !parentSiblingEl.querySelector('picture')
&& parentSiblingEl.firstChild.tagName === 'EM'
? parentSiblingEl.querySelector('em')
: undefined;
if (!parentSiblingEl || !parentSiblingEl.querySelector('picture')) return undefined;
const firstChildEl = parentSiblingEl.firstChild;
caption = firstChildEl?.tagName === 'EM' ? firstChildEl : undefined;
return caption;
}

Expand All @@ -120,9 +118,7 @@ async function buildArticleHeader(el) {
const { codeRoot } = getConfig();
const authorURL = getMetadata('author-url') || (author ? `${codeRoot}/authors/${author.replace(/[^0-9a-z]/gi, '-').toLowerCase()}` : null);
const publicationDate = getMetadata('publication-date');

const categoryTag = getLinkForTopic(category);

const articleHeaderBlockEl = buildBlock('article-header', [
[`<p>${categoryTag}</p>`],
[h1],
Expand Down

0 comments on commit 1a6c028

Please sign in to comment.