fix: transform links with basepath
This commit is contained in:
17
index.js
17
index.js
@@ -5,6 +5,7 @@ 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'
|
import collections from '@metalsmith/collections'
|
||||||
|
import inPlace from '@metalsmith/in-place'
|
||||||
|
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||||
const t1 = performance.now()
|
const t1 = performance.now()
|
||||||
@@ -36,14 +37,26 @@ Metalsmith(__dirname)
|
|||||||
TZ: 'Europe/Paris',
|
TZ: 'Europe/Paris',
|
||||||
})
|
})
|
||||||
.metadata(sitedata)
|
.metadata(sitedata)
|
||||||
|
.use(inPlace({
|
||||||
|
pattern: '**/*.md',
|
||||||
|
transform: 'handlebars'
|
||||||
|
}))
|
||||||
.use(markdown())
|
.use(markdown())
|
||||||
|
.use(permalinks())
|
||||||
.use(collections({
|
.use(collections({
|
||||||
nav: {
|
nav: {
|
||||||
pattern: '**/*.html',
|
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({
|
.use(layouts({
|
||||||
directory: 'layouts',
|
directory: 'layouts',
|
||||||
default: 'default.hbs',
|
default: 'default.hbs',
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<img src="{{ site.basePath }}/assets/images/brand.jpg" alt="Logo du {{ site.subject }}" />
|
<img src="{{ site.basePath }}/assets/images/brand.jpg" alt="Logo du {{ site.subject }}" />
|
||||||
<nav>
|
<nav>
|
||||||
{{#each collections.nav}}
|
{{#each collections.nav}}
|
||||||
<a href="{{ this.path }}">{{ this.title }}</a>
|
<a href="{{ basePath }}/{{ path }}">{{ title }}</a>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</nav>
|
</nav>
|
||||||
<button id="theme-toggle" class="theme-toggle">🌙</button>
|
<button id="theme-toggle" class="theme-toggle">🌙</button>
|
||||||
@@ -75,8 +75,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="{{ site.basePath }}/assets/scripts/theme-toggle.js" async defer ></script>
|
<script async src="{{ site.basePath }}/assets/scripts/theme-toggle.js" ></script>
|
||||||
<script src="{{ site.basePath }}/assets/scripts/page-size.js" async defer ></script>
|
<script src="{{ site.basePath }}/assets/scripts/page-size.js" ></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
16
package-lock.json
generated
16
package-lock.json
generated
@@ -7,6 +7,7 @@
|
|||||||
"name": "ltg-grenoble",
|
"name": "ltg-grenoble",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@metalsmith/collections": "^1.3.1",
|
"@metalsmith/collections": "^1.3.1",
|
||||||
|
"@metalsmith/in-place": "^5.0.0",
|
||||||
"@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",
|
||||||
@@ -32,6 +33,21 @@
|
|||||||
"metalsmith": "^2.5.0"
|
"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": {
|
"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",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@metalsmith/collections": "^1.3.1",
|
"@metalsmith/collections": "^1.3.1",
|
||||||
|
"@metalsmith/in-place": "^5.0.0",
|
||||||
"@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",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ title: Accueil
|
|||||||
nav_order: 0
|
nav_order: 0
|
||||||
---
|
---
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
# Présentation de l'asso
|
# Présentation de l'asso
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user