Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set base href in head #70

Merged
merged 3 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions best-cigars-guide/blocks/article-list/article-list.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createOptimizedPicture } from '../../scripts/aem.js';
import { requireSubfolderImagePath } from '../../scripts/scripts.js';

export default function decorate(block) {
// Add Article list
Expand Down Expand Up @@ -78,8 +77,6 @@ export default function decorate(block) {

// format images
ul.querySelectorAll('img').forEach((img) => {
// require subfolder in image path
requireSubfolderImagePath(img);
// optimize image
img.closest('picture').replaceWith(createOptimizedPicture(img.src, img.alt, false, [{ width: '750' }]));
});
Expand Down
6 changes: 0 additions & 6 deletions best-cigars-guide/blocks/header/header.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { getMetadata } from '../../scripts/aem.js';
import { loadFragment } from '../fragment/fragment.js';
import { requireSubfolderImagePath } from '../../scripts/scripts.js';

// media query match that indicates mobile/tablet width
const isDesktop = window.matchMedia('(min-width: 900px)');
Expand Down Expand Up @@ -162,11 +161,6 @@ export default async function decorate(block) {
`;
navTools.innerHTML = searchBox.innerHTML;

// Fix meta image paths
document.querySelectorAll('meta[property="og:image:secure_url"], meta[property="og:image"], meta[name="twitter:image"]').forEach((metaImage) => {
requireSubfolderImagePath(metaImage);
});

// Wrap it up!
const navWrapper = document.createElement('div');
navWrapper.className = 'nav-wrapper';
Expand Down
13 changes: 0 additions & 13 deletions best-cigars-guide/blocks/hero/hero.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable max-len */

import { requireSubfolderImagePath } from '../../scripts/scripts.js';

// Add second paragraph text and chevron to the hero image when available
function addSecondParagraphToHero() {
// Select the div with class 'hero-container'
Expand Down Expand Up @@ -65,17 +63,6 @@ function addSecondParagraphToHero() {
}
}

// Format picture path
function formatPicturePath() {
const picture = document.querySelector('.hero picture');
if (picture) {
picture.querySelectorAll('img, source').forEach((element) => {
requireSubfolderImagePath(element);
});
}
}

export default function decorate() {
addSecondParagraphToHero();
formatPicturePath();
}
1 change: 1 addition & 0 deletions head.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<base href="/best-cigars-guide/">
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<script src="/best-cigars-guide/scripts/aem.js" type="module"></script>
<script src="/best-cigars-guide/scripts/scripts.js" type="module"></script>
Expand Down