From 56c67dd5648d865563f566a51e89ce56e2dddba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Viricel?= Date: Fri, 7 Feb 2025 16:09:32 +0100 Subject: [PATCH] feat: add auto menu --- index.js | 15 +++++++-------- layouts/default.hbs | 13 ++++++------- package-lock.json | 35 +++++++++++++++++++++++++++++++++++ package.json | 1 + src/actions.md | 1 + src/assets/css/helpers.css | 5 +++++ src/blog.md | 1 + src/contact.md | 1 + src/faq.md | 1 + src/index.md | 1 + src/ressources.md | 1 + 11 files changed, 60 insertions(+), 15 deletions(-) create mode 100644 src/assets/css/helpers.css diff --git a/index.js b/index.js index 902a510..59b3a35 100644 --- a/index.js +++ b/index.js @@ -4,6 +4,7 @@ import Metalsmith from 'metalsmith' import layouts from '@metalsmith/layouts' import markdown from '@metalsmith/markdown' import permalinks from '@metalsmith/permalinks' +import collections from '@metalsmith/collections' const __dirname = dirname(fileURLToPath(import.meta.url)) const t1 = performance.now() @@ -17,14 +18,6 @@ const sitedata = { contact: 'contact@lowtechlabgrenoble.org', address: '48 Ave. Washington, 38100 Grenoble' }, - nav: [ - { path: 'index.html', label: 'Accueil' }, - { path: 'actions.html', label: 'Actions' }, - { path: 'contact.html', label: 'Contact' }, - { path: 'faq.html', label: 'FAQ' }, - { path: 'ressources.html', label: 'Ressources' }, - { path: 'blog.html', label: 'Blog' } - ], socials: { twitter: 'https://twitter.com/johndoe', facebook: 'https://facebook.com/johndoe', @@ -44,6 +37,12 @@ Metalsmith(__dirname) }) .metadata(sitedata) .use(markdown()) + .use(collections({ + nav: { + pattern: '**/*.html', + sortBy: 'nav_order' + } + })) .use(permalinks()) .use(layouts({ directory: 'layouts', diff --git a/layouts/default.hbs b/layouts/default.hbs index 7e5505f..ab70cf9 100644 --- a/layouts/default.hbs +++ b/layouts/default.hbs @@ -8,6 +8,7 @@ {{ site.subject }} — {{ title }} + @@ -15,6 +16,7 @@ @@ -22,17 +24,14 @@
Logo du {{ site.subject }}
-

{{ title }}

+

{{ title }}

{{{ contents }}} {{!-- {{#if postlist}}