Skip to content

Commit

Permalink
Merge pull request #346 from Buuhuu/fix-header-footer-loading
Browse files Browse the repository at this point in the history
fix: header/footer fragment loading (#13)
  • Loading branch information
fkakatie authored Apr 12, 2024
2 parents 34be78b + f5198b5 commit 72e2aa5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion blocks/footer/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default async function decorate(block) {
block.textContent = '';

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

// decorate footer DOM
Expand Down
2 changes: 1 addition & 1 deletion blocks/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function toggleMenu(nav, navSections, forceExpanded = null) {
export default async function decorate(block) {
// load nav as fragment
const navMeta = getMetadata('nav');
const navPath = navMeta ? new URL(navMeta).pathname : '/nav';
const navPath = navMeta ? new URL(navMeta, window.location).pathname : '/nav';
const fragment = await loadFragment(navPath);

// decorate nav DOM
Expand Down

0 comments on commit 72e2aa5

Please sign in to comment.