diff --git a/.eleventy.js b/.eleventy.js index 2d054fc..ecde608 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -36,7 +36,7 @@ module.exports = (config) => { // add collection for pages config.addCollection('categories', (collection) => { - // let categories = collection.getFilteredByGlob('**') + let categories = fs.readdirSync('_content') categories = categories.filter(c => !c.match(/\.[^/.]{1,4}$/i)) @@ -64,7 +64,17 @@ module.exports = (config) => { _cat[cat] = sorted.concat(unsorted) }) - return _cat + let _p = collection.getFilteredByGlob('_content/*.md') + let pages = {} + // _cat = { ..._cat, ...pages } + + _p.forEach(p => { + if (p.data.title != 'index') { + pages[p.data.title] = p + } + }) + + return { ..._cat, ...pages } }) // custom filters diff --git a/_data/site.js b/_data/site.js index 2739b8e..f82213f 100644 --- a/_data/site.js +++ b/_data/site.js @@ -1,4 +1,3 @@ -const fs = require('fs/promises') const eleventyPackage = require('@11ty/eleventy/package.json') module.exports = async () => { diff --git a/_includes/components/nav-primary.js b/_includes/components/nav-primary.js index 58bc4dc..8f68884 100644 --- a/_includes/components/nav-primary.js +++ b/_includes/components/nav-primary.js @@ -28,6 +28,8 @@ class NavPrimary extends HTMLElement { const category = n.attributes.getNamedItem('category') const link = n.attributes.getNamedItem('link') + console.log(link) + if (link) { history.pushState({}, '', link.value) location.pathname = link.value diff --git a/_includes/components/nav-primary.webc b/_includes/components/nav-primary.webc index 39e814f..3139081 100644 --- a/_includes/components/nav-primary.webc +++ b/_includes/components/nav-primary.webc @@ -1,18 +1,23 @@