diff --git a/index.js b/index.js index 4f0eaf8..a72e3a1 100644 --- a/index.js +++ b/index.js @@ -5,6 +5,7 @@ import layouts from '@metalsmith/layouts' import markdown from '@metalsmith/markdown' import permalinks from '@metalsmith/permalinks' import collections from '@metalsmith/collections' +import inPlace from '@metalsmith/in-place' const __dirname = dirname(fileURLToPath(import.meta.url)) const t1 = performance.now() @@ -36,14 +37,26 @@ Metalsmith(__dirname) TZ: 'Europe/Paris', }) .metadata(sitedata) + .use(inPlace({ + pattern: '**/*.md', + transform: 'handlebars' + })) .use(markdown()) + .use(permalinks()) .use(collections({ nav: { pattern: '**/*.html', - sortBy: 'nav_order' + sortBy: 'nav_order', + metadata: { + base: sitedata.site.basePath + } } })) - .use(permalinks()) + .use(function addBasePathToCollection(files) { + Object.values(files).forEach(file => { + file.basePath = sitedata.site.basePath; + }); + }) .use(layouts({ directory: 'layouts', default: 'default.hbs', diff --git a/layouts/default.hbs b/layouts/default.hbs index 4293dbe..123fdd7 100644 --- a/layouts/default.hbs +++ b/layouts/default.hbs @@ -25,7 +25,7 @@ Logo du {{ site.subject }} @@ -75,8 +75,8 @@ - - + + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5521c6b..6712dbd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "name": "ltg-grenoble", "dependencies": { "@metalsmith/collections": "^1.3.1", + "@metalsmith/in-place": "^5.0.0", "@metalsmith/layouts": "^2.7.0", "@metalsmith/markdown": "^1.10.0", "@metalsmith/permalinks": "^3.2.0", @@ -32,6 +33,21 @@ "metalsmith": "^2.5.0" } }, + "node_modules/@metalsmith/in-place": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@metalsmith/in-place/-/in-place-5.0.0.tgz", + "integrity": "sha512-7b7w4OPm5yvBysEVbFcEsEtrToEhcN8gv9+MJTmvu3SPVnflJ9i8W4MfZfG71hIi8hvKEqQFGdKgAzhcX8d1zQ==", + "dependencies": { + "is-utf8": "^0.2.1", + "jstransformer": "^1.0.0" + }, + "engines": { + "node": ">=14.14.0" + }, + "peerDependencies": { + "metalsmith": "^2.5.0" + } + }, "node_modules/@metalsmith/layouts": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/@metalsmith/layouts/-/layouts-2.7.0.tgz", diff --git a/package.json b/package.json index 98514bc..9639bcb 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ }, "dependencies": { "@metalsmith/collections": "^1.3.1", + "@metalsmith/in-place": "^5.0.0", "@metalsmith/layouts": "^2.7.0", "@metalsmith/markdown": "^1.10.0", "@metalsmith/permalinks": "^3.2.0", diff --git a/src/index.md b/src/index.md index c247644..caa2e63 100644 --- a/src/index.md +++ b/src/index.md @@ -3,7 +3,7 @@ title: Accueil nav_order: 0 --- -![Photo de l'équipe ?]({{site.basePath}}/assets/images/team.jpg) +![Photo de l'équipe ?]({{ site.basePath }}/assets/images/team.jpg) # Présentation de l'asso