Skip to content

Commit

Permalink
refactor function
Browse files Browse the repository at this point in the history
  • Loading branch information
bdeffleyfamous committed Jun 14, 2024
1 parent e370c50 commit 7ab4eb3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cigaradvisor/scripts/linking-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,16 @@ function addFAQLdJson() {
}

export default function addLinkingData() {
const category = getCategory(window.location.pathname);
addOrg(document.querySelector('head'));
if (window.location.pathname === '/cigaradvisor') {
addBlogPosts();
} else if (window.location.pathname === category) {
addOrUpdateCollection();
window.addEventListener('hashchange', addOrUpdateCollection);
} else if (category) {
addFAQLdJson();
} else {
const category = getCategory(window.location.pathname);
if (window.location.pathname === category) {
addOrUpdateCollection();
window.addEventListener('hashchange', addOrUpdateCollection);
} else if (category) {
addFAQLdJson();
}
}
}

0 comments on commit 7ab4eb3

Please sign in to comment.