From 7eb8dec838842a8e9e4eabd9aaaa94faeae8fb94 Mon Sep 17 00:00:00 2001 From: suroh Date: Tue, 6 Feb 2024 14:15:42 +0100 Subject: [PATCH] fixed submenus not working --- .eleventy.js | 3 +-- _includes/components/nav-primary.js | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index 5fc2f8a..0d467b0 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -46,7 +46,7 @@ module.exports = (config) => { let sorted = [] let unsorted = [] - let pages = collection.getFilteredByGlob(`src/_content/work/${cat}/*.md`) + let pages = collection.getFilteredByGlob(`_content/${cat}/*.md`) for (let page of pages) { if (page.data.sort) { @@ -66,7 +66,6 @@ module.exports = (config) => { let _p = collection.getFilteredByGlob('_content/*.md') let pages = {} - // _cat = { ..._cat, ...pages } _p.forEach(p => { if (p.data.title != 'index') { diff --git a/_includes/components/nav-primary.js b/_includes/components/nav-primary.js index 8f68884..db33212 100644 --- a/_includes/components/nav-primary.js +++ b/_includes/components/nav-primary.js @@ -13,7 +13,7 @@ class NavPrimary extends HTMLElement { this.setupAudio() this.categories = this.querySelectorAll('nav-link') - this.subs = this.querySelectorAll('ul') + this.subs = this.querySelectorAll('#sub ul') this.activate() @@ -28,7 +28,7 @@ class NavPrimary extends HTMLElement { const category = n.attributes.getNamedItem('category') const link = n.attributes.getNamedItem('link') - console.log(link) + console.log('category click', link, category) if (link) { history.pushState({}, '', link.value) @@ -63,7 +63,6 @@ class NavPrimary extends HTMLElement { activate() { let active, toOpen - this.categories.forEach(c => { const { value } = c.attributes.getNamedItem('category') || false @@ -74,6 +73,7 @@ class NavPrimary extends HTMLElement { } }) + console.log(this.subs) this.subs.forEach(s => { const { name } = s.dataset