Skip to content

Commit

Permalink
Sync to Stage: Sprint-2 (#316)
Browse files Browse the repository at this point in the history
* PM-820: add nullish check on anchor for card heading (#314)

* PM-752: Fixes for HTTPS has Internal Links to HTTP (#315)

* PM-752: Update url formatting property

* PM-752: for converted authored localhost links, use window.location properties instead of prod domain so links are not identified as external in cleanLocalhostLinks

* PM-752: remove target blank from corrected localhost links set as external

* PM-752: reverting eslint rule

---------

Co-authored-by: Daniel O'Kane <[email protected]>

---------

Co-authored-by: Daniel O'Kane <[email protected]>
  • Loading branch information
pgilmore-phi and hero-dokane authored Jan 21, 2025
1 parent 29f0b4e commit 0610998
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion blocks/cards/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
8 changes: 5 additions & 3 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
});
}
Expand Down

0 comments on commit 0610998

Please sign in to comment.