Skip to content

Commit

Permalink
early return
Browse files Browse the repository at this point in the history
  • Loading branch information
meganthecoder committed Sep 7, 2023
1 parent 6b8d3a3 commit b8ed2e9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ function buildBlock(blockName, content) {
}

function buildTagsBlock() {
const tagsArray = [...document.head.querySelectorAll('meta[property="article:tag"]')].map((el) => el.content) || [];
const metadata = document.head.querySelectorAll('meta[property="article:tag"]');
if (!metadata.length) return;
const tagsArray = [...metadata].map((el) => el.content);
const tagsBlock = buildBlock('tags', tagsArray.join(', '));
const main = document.querySelector('main');
const recBlock = main.querySelector('.recommended-articles');
Expand Down

0 comments on commit b8ed2e9

Please sign in to comment.