feat: add auto menu

This commit is contained in:
2025-02-07 16:09:32 +01:00
parent c97a015a71
commit 56c67dd564
11 changed files with 60 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ import Metalsmith from 'metalsmith'
import layouts from '@metalsmith/layouts' import layouts from '@metalsmith/layouts'
import markdown from '@metalsmith/markdown' import markdown from '@metalsmith/markdown'
import permalinks from '@metalsmith/permalinks' import permalinks from '@metalsmith/permalinks'
import collections from '@metalsmith/collections'
const __dirname = dirname(fileURLToPath(import.meta.url)) const __dirname = dirname(fileURLToPath(import.meta.url))
const t1 = performance.now() const t1 = performance.now()
@@ -17,14 +18,6 @@ const sitedata = {
contact: 'contact@lowtechlabgrenoble.org', contact: 'contact@lowtechlabgrenoble.org',
address: '48 Ave. Washington, 38100 Grenoble' 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: { socials: {
twitter: 'https://twitter.com/johndoe', twitter: 'https://twitter.com/johndoe',
facebook: 'https://facebook.com/johndoe', facebook: 'https://facebook.com/johndoe',
@@ -44,6 +37,12 @@ Metalsmith(__dirname)
}) })
.metadata(sitedata) .metadata(sitedata)
.use(markdown()) .use(markdown())
.use(collections({
nav: {
pattern: '**/*.html',
sortBy: 'nav_order'
}
}))
.use(permalinks()) .use(permalinks())
.use(layouts({ .use(layouts({
directory: 'layouts', directory: 'layouts',

View File

@@ -8,6 +8,7 @@
<title>{{ site.subject }} &mdash; {{ title }}</title> <title>{{ site.subject }} &mdash; {{ title }}</title>
<link rel="preload" href="/assets/css/reset.css" as="style" onload="this.onload=null;this.rel='stylesheet'"> <link rel="preload" href="/assets/css/reset.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<link rel="preload" href="/assets/css/theme.css" as="style" onload="this.onload=null;this.rel='stylesheet'"> <link rel="preload" href="/assets/css/theme.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<link rel="preload" href="/assets/css/helpers.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<link rel="stylesheet" href="/assets/css/main.css"> <link rel="stylesheet" href="/assets/css/main.css">
<link rel="stylesheet" href="/assets/css/typography.css"> <link rel="stylesheet" href="/assets/css/typography.css">
<link rel="stylesheet" href="/assets/css/header.css"> <link rel="stylesheet" href="/assets/css/header.css">
@@ -15,6 +16,7 @@
<noscript> <noscript>
<link rel="stylesheet" href="/assets/css/reset.css"> <link rel="stylesheet" href="/assets/css/reset.css">
<link rel="stylesheet" href="/assets/css/theme.css"> <link rel="stylesheet" href="/assets/css/theme.css">
<link rel="stylesheet" href="/assets/css/helpers.css">
</noscript> </noscript>
</head> </head>
@@ -22,17 +24,14 @@
<header> <header>
<img src="/assets/images/brand.jpg" alt="Logo du {{ site.subject }}" /> <img src="/assets/images/brand.jpg" alt="Logo du {{ site.subject }}" />
<nav> <nav>
<a href="/">Accueil</a> {{#each collections.nav}}
<a href="/actions">Actions</a> <a href="{{ this.path }}">{{ this.title }}</a>
<a href="/contact">Contact</a> {{/each}}
<a href="/faq">FAQ</a>
<a href="/ressources">Ressources</a>
<a href="/blog">Blog</a>
</nav> </nav>
<button id="theme-toggle" class="theme-toggle">🌙</button> <button id="theme-toggle" class="theme-toggle">🌙</button>
</header> </header>
<main> <main>
<h1>{{ title }}</h1> <h1 class="hidden">{{ title }}</h1>
{{{ contents }}} {{{ contents }}}
{{!-- {{#if postlist}} {{!-- {{#if postlist}}
<ul> <ul>

35
package-lock.json generated
View File

@@ -6,6 +6,7 @@
"": { "": {
"name": "ltg-grenoble", "name": "ltg-grenoble",
"dependencies": { "dependencies": {
"@metalsmith/collections": "^1.3.1",
"@metalsmith/layouts": "^2.7.0", "@metalsmith/layouts": "^2.7.0",
"@metalsmith/markdown": "^1.10.0", "@metalsmith/markdown": "^1.10.0",
"@metalsmith/permalinks": "^3.2.0", "@metalsmith/permalinks": "^3.2.0",
@@ -16,6 +17,21 @@
"serve": "^14.2.4" "serve": "^14.2.4"
} }
}, },
"node_modules/@metalsmith/collections": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/@metalsmith/collections/-/collections-1.3.1.tgz",
"integrity": "sha512-u2Y3P7lJMtBchxVZZKU4hbVDtq7hqebZoYwk6e/VSvl84Uc9W7D4i47Cwo54bmrCxXalDe+A2Rf0BZr1jnYvKg==",
"dependencies": {
"lodash.get": "^4.4.2",
"read-metadata": "^1.0.0"
},
"engines": {
"node": ">=12"
},
"peerDependencies": {
"metalsmith": "^2.5.0"
}
},
"node_modules/@metalsmith/layouts": { "node_modules/@metalsmith/layouts": {
"version": "2.7.0", "version": "2.7.0",
"resolved": "https://registry.npmjs.org/@metalsmith/layouts/-/layouts-2.7.0.tgz", "resolved": "https://registry.npmjs.org/@metalsmith/layouts/-/layouts-2.7.0.tgz",
@@ -911,6 +927,12 @@
"resolved": "https://registry.npmjs.org/lodash.clonedeepwith/-/lodash.clonedeepwith-4.5.0.tgz", "resolved": "https://registry.npmjs.org/lodash.clonedeepwith/-/lodash.clonedeepwith-4.5.0.tgz",
"integrity": "sha512-QRBRSxhbtsX1nc0baxSkkK5WlVTTm/s48DSukcGcWZwIyI8Zz+lB+kFiELJXtzfH4Aj6kMWQ1VWW4U5uUDgZMA==" "integrity": "sha512-QRBRSxhbtsX1nc0baxSkkK5WlVTTm/s48DSukcGcWZwIyI8Zz+lB+kFiELJXtzfH4Aj6kMWQ1VWW4U5uUDgZMA=="
}, },
"node_modules/lodash.get": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
"integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==",
"deprecated": "This package is deprecated. Use the optional chaining (?.) operator instead."
},
"node_modules/marked": { "node_modules/marked": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz",
@@ -1158,6 +1180,14 @@
"rc": "cli.js" "rc": "cli.js"
} }
}, },
"node_modules/read-metadata": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/read-metadata/-/read-metadata-1.0.0.tgz",
"integrity": "sha512-XJdiOrkzOlIac9vXNvgp/4I8qj9EPuHlbf/eoX2rusLFjdKjp0TQ82V3cj+AFjXBzzoZ1TaqAtHnGsR3UdO1Gw==",
"dependencies": {
"yaml-js": "0.0.8"
}
},
"node_modules/readdirp": { "node_modules/readdirp": {
"version": "3.6.0", "version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
@@ -1548,6 +1578,11 @@
"dependencies": { "dependencies": {
"co": "3.1.0" "co": "3.1.0"
} }
},
"node_modules/yaml-js": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/yaml-js/-/yaml-js-0.0.8.tgz",
"integrity": "sha512-XCqDFUhDO3yhT+Rb/inT3uiC8ekx2lXHDgDeXY8V0Lgkx4yEhzhxraYQxtuajydIrx8L8KmF9OeKCDlyCjvnMQ=="
} }
} }
} }

View File

@@ -7,6 +7,7 @@
"start": "serve build" "start": "serve build"
}, },
"dependencies": { "dependencies": {
"@metalsmith/collections": "^1.3.1",
"@metalsmith/layouts": "^2.7.0", "@metalsmith/layouts": "^2.7.0",
"@metalsmith/markdown": "^1.10.0", "@metalsmith/markdown": "^1.10.0",
"@metalsmith/permalinks": "^3.2.0", "@metalsmith/permalinks": "^3.2.0",

View File

@@ -1,5 +1,6 @@
--- ---
title: Actions title: Actions
nav_order: 1
--- ---
# Action locale (quartier Abbaye) # Action locale (quartier Abbaye)

View File

@@ -0,0 +1,5 @@
.hidden {
visibility: hidden;
width: 0;
height: 0;
}

View File

@@ -1,5 +1,6 @@
--- ---
title: Blog title: Blog
nav_order: 5
--- ---
#Blog #Blog

View File

@@ -1,5 +1,6 @@
--- ---
title: Contact title: Contact
nav_order: 2
--- ---
Vous souhaitez rentrer en contact avec nous ? Ecrivez-nous ! Vous souhaitez rentrer en contact avec nous ? Ecrivez-nous !

View File

@@ -1,5 +1,6 @@
--- ---
title: FAQ title: FAQ
nav_order: 4
--- ---
Pas sûr quon en ait besoin, mais peut servir à éclarcir qqs questions récurrentes comme : Pas sûr quon en ait besoin, mais peut servir à éclarcir qqs questions récurrentes comme :

View File

@@ -1,5 +1,6 @@
--- ---
title: Accueil title: Accueil
nav_order: 0
--- ---
![Photo de l'équipe ?](/assets/images/team.jpg) ![Photo de l'équipe ?](/assets/images/team.jpg)

View File

@@ -1,5 +1,6 @@
--- ---
title: Ressources title: Ressources
nav_order: 3
--- ---
# Présentation des LT disponibles en prêt à prix libre & de la procédure (Si pas dans “Actions de lasso”) # Présentation des LT disponibles en prêt à prix libre & de la procédure (Si pas dans “Actions de lasso”)