First commit of i18n base blog using Eleventy v2. This uses English-implied URLs.

This commit is contained in:
Zach Leatherman
2022-07-15 12:11:54 -05:00
parent 70530889e4
commit 2491464043
26 changed files with 88 additions and 43 deletions

9
en/en.11tydata.js Normal file
View File

@@ -0,0 +1,9 @@
module.exports = {
lang: "en",
permalink: function(data) {
// Change (English) /en/blog/my-post URLs to have an implied language code /blog/my-post URLs instead.
let [slashPrefixEmpty, langCode, ...stem] = data.page.filePathStem.split("/");
let path = stem.join("/");
return stem[stem.length - 1] === "index" ? `${path}.html` : `${path}/index.html`;
}
}