Skip to content

Commit

Permalink
fixing 404 page crash
Browse files Browse the repository at this point in the history
  • Loading branch information
DriftingSands committed Sep 26, 2023
1 parent f2c49a4 commit b1249ef
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ const range = document.createRange();

// getting real path, and adjusting canonical link to use the vanity path
const canonicalLinkTag = document.head.querySelector('link[rel="canonical"]');
const longPathMetadata = document.createElement('meta');
longPathMetadata.setAttribute('property', 'hlx:long-form-path');
longPathMetadata.content = canonicalLinkTag.href;
document.head.appendChild(longPathMetadata);
window.canonicalLocation = canonicalLinkTag.href;
canonicalLinkTag.href = window.location.href;
if (canonicalLinkTag) {
const longPathMetadata = document.createElement('meta');
longPathMetadata.setAttribute('property', 'hlx:long-form-path');
longPathMetadata.content = canonicalLinkTag?.href;
document.head.appendChild(longPathMetadata);
window.canonicalLocation = canonicalLinkTag.href;
canonicalLinkTag.href = window.location.href;
}

export function replaceLinksWithEmbed(block) {
const embeds = ['youtube', 'brightcove', 'instagram', 'ceros'];
Expand Down

0 comments on commit b1249ef

Please sign in to comment.