Skip to content

Commit 72e2aa5

Browse files
authored
Merge pull request #346 from Buuhuu/fix-header-footer-loading
fix: header/footer fragment loading (#13)
2 parents 34be78b + f5198b5 commit 72e2aa5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

blocks/footer/footer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default async function decorate(block) {
1010
block.textContent = '';
1111

1212
// load footer fragment
13-
const footerPath = footerMeta.footer || '/footer';
13+
const footerPath = footerMeta ? new URL(footerMeta, window.location).pathname : '/footer';
1414
const fragment = await loadFragment(footerPath);
1515

1616
// decorate footer DOM

blocks/header/header.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function toggleMenu(nav, navSections, forceExpanded = null) {
9393
export default async function decorate(block) {
9494
// load nav as fragment
9595
const navMeta = getMetadata('nav');
96-
const navPath = navMeta ? new URL(navMeta).pathname : '/nav';
96+
const navPath = navMeta ? new URL(navMeta, window.location).pathname : '/nav';
9797
const fragment = await loadFragment(navPath);
9898

9999
// decorate nav DOM

0 commit comments

Comments
 (0)