From 953ed52c2e250c6675d183c24861346eee235b37 Mon Sep 17 00:00:00 2001 From: Karl Pauls Date: Tue, 16 Apr 2024 10:17:12 +0200 Subject: [PATCH] Rewrite links to work with helix5 (#579) --- .github/pull_request_template.md | 4 ++-- README.md | 4 ++-- blocks/pdf-viewer/pdf-viewer.js | 4 ++-- scripts/lib-franklin.js | 4 +++- scripts/scripts.js | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 5d066fa0..1be078de 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -3,5 +3,5 @@ Please always provide the [GitHub issue(s)](../issues) your PR is for, as well a Fix # Test URLs: -- Before: https://main--mammotome--hlxsites.hlx.page/us/en/ -- After: https://--mammotome--hlxsites.hlx.page/us/en/ +- Before: https://main--mammotome--hlxsites.aem.page/us/en/ +- After: https://--mammotome--hlxsites.aem.page/us/en/ diff --git a/README.md b/README.md index a68beaa1..5c9c36ac 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ Franklin site implementing https://www.mammotome.com/ ## Environments -- Preview: https://main--mammotome--hlxsites.hlx.page/ -- Live: https://main--mammotome--hlxsites.hlx.live/ +- Preview: https://main--mammotome--hlxsites.aem.page/ +- Live: https://main--mammotome--hlxsites.aem.live/ ## Installation diff --git a/blocks/pdf-viewer/pdf-viewer.js b/blocks/pdf-viewer/pdf-viewer.js index aa0b3de8..d1f64836 100644 --- a/blocks/pdf-viewer/pdf-viewer.js +++ b/blocks/pdf-viewer/pdf-viewer.js @@ -15,8 +15,8 @@ let sdkLoaded = false; * A key is domain-specific and convers all subdomains. As such the placeholders need to * feature a key per .. In this case a key each for: * - localhost - * - hlx.page - * - hlx.live + * - aem.page + * - aem.live * - mammotome.com * * This method checks the host from `window.location` and returns the respective placeholder diff --git a/scripts/lib-franklin.js b/scripts/lib-franklin.js index 74cf9afb..85ceae18 100644 --- a/scripts/lib-franklin.js +++ b/scripts/lib-franklin.js @@ -519,7 +519,7 @@ export function getInfo() { export function adjustAssetURL(asset) { if (asset?.URL) { const url = new URL(asset.URL, window.location); - const isLocalOrHlx = ['localhost', '-mammotome--hlxsites.hlx.page', '-mammotome--hlxsites.hlx.live'] + const isLocalOrHlx = ['localhost', '-mammotome--hlxsites.hlx.page', '-mammotome--hlxsites.hlx.live', '-mammotome--hlxsites.aem.page', '-mammotome--hlxsites.aem.live'] .some((domain) => url.hostname.endsWith(domain)); if (isLocalOrHlx) { @@ -1069,6 +1069,8 @@ export function decorateBlockImgs(block) { if (hostname === window.location.hostname || hostname.endsWith('-mammotome--hlxsites.hlx.page') || hostname.endsWith('-mammotome--hlxsites.hlx.live') + || hostname.endsWith('-mammotome--hlxsites.aem.page') + || hostname.endsWith('-mammotome--hlxsites.aem.live') || hostname === 'localhost') { img.replaceWith( createOptimizedPicture(img.src, img.alt, false, img.width, img.height), diff --git a/scripts/scripts.js b/scripts/scripts.js index 80968c3e..5c38bb43 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -327,7 +327,7 @@ async function loadLazy(doc) { // google tag manager function loadGTM() { - if (window.location.hostname.includes('localhost') || document.location.hostname.includes('.hlx.page')) { + if (window.location.hostname.includes('localhost') || document.location.hostname.includes('.hlx.page') || document.location.hostname.includes('.aem.page')) { return; }