Skip to content

Commit

Permalink
Rewrite links to work with helix5 (#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
karlpauls authored Apr 16, 2024
1 parent bddefb2 commit 953ed52
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ Please always provide the [GitHub issue(s)](../issues) your PR is for, as well a
Fix #<gh-issue-id>

Test URLs:
- Before: https://main--mammotome--hlxsites.hlx.page/us/en/
- After: https://<branch>--mammotome--hlxsites.hlx.page/us/en/
- Before: https://main--mammotome--hlxsites.aem.page/us/en/
- After: https://<branch>--mammotome--hlxsites.aem.page/us/en/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions blocks/pdf-viewer/pdf-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <domain>.<tld>. 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
Expand Down
4 changes: 3 additions & 1 deletion scripts/lib-franklin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 953ed52

Please sign in to comment.