diff --git a/blocks/cards/cards.js b/blocks/cards/cards.js index 0a543fc..9d1d7e4 100644 --- a/blocks/cards/cards.js +++ b/blocks/cards/cards.js @@ -301,7 +301,7 @@ export default async function decorate(block) { } else { div.className = 'cards-card-body'; const h4 = li.querySelector('h4'); - if (h4) { + if (h4 && href) { wrapInAnchor(h4, href); } } diff --git a/scripts/scripts.js b/scripts/scripts.js index b9d9ce8..0949cb8 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -416,10 +416,12 @@ function cleanLocalhostLinks(main) { .forEach((anchor) => { if (anchor.href.startsWith('http://localhost:3001')) { const url = new URL(anchor.href); - url.hostname = 'www.24petwatch.com'; - url.scheme = 'https'; - url.port = ''; + url.hostname = window.location.hostname; + url.protocol = window.location.protocol; + url.port = window.location.port; anchor.href = url.toString(); + // remove target="_blank" from localhost links + anchor.removeAttribute('target'); } }); }