Skip to content

Commit

Permalink
set the base path to menu component
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Sep 16, 2024
1 parent ac5f710 commit d0c7f1d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/_includes/templates/menu.vto
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{{ /if }}

{{ set menu = alternates?.length ? `/menu-${lang}.json` : '/menu.json' }}
<tree-menu class="menu" data-url="{{ menu |> url }}">
<tree-menu class="menu" data-base="{{ "/" |> url }}" data-url="{{ menu |> url }}">
{{ if menu_links?.length }}
<ul>
{{- for link of menu_links }}
Expand Down
2 changes: 1 addition & 1 deletion src/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ customElements.define(
render(menu, ul, url) {
const fragment = document.createDocumentFragment();
const baseUrl = new URL(
this.getAttribute("base-url") ?? "/",
this.dataset.base ?? "/",
document.location.origin,
);

Expand Down

0 comments on commit d0c7f1d

Please sign in to comment.