Skip to content

Commit

Permalink
Merge pull request #118 from adobecom/MWPW-161359-preview-wrong-domain
Browse files Browse the repository at this point in the history
MWPW-161359: Just set path to card link
  • Loading branch information
zagi25 authored Nov 5, 2024
2 parents 641146a + 89781f6 commit c7bf51c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion edsdme/blocks/announcements-preview/announcements-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { getConfig } from '../utils/utils.js';
function addAnnouncement(cardData) {
const linkWrapper = document.createElement('a');
linkWrapper.className = 'link-wrapper';
linkWrapper.href = cardData.contentArea.url;
const { hostname, pathname } = new URL(cardData.contentArea.url);
const isMiloUrl = hostname.endsWith('hlx.live') || hostname.endsWith('hlx.page');

linkWrapper.href = isMiloUrl ? pathname : cardData.contentArea.url;
linkWrapper.target = '_blank';

linkWrapper.style.display = 'block';
Expand Down

0 comments on commit c7bf51c

Please sign in to comment.