First commit of i18n base blog using Eleventy v2. This uses English-implied URLs.
This commit is contained in:
9
en/en.11tydata.js
Normal file
9
en/en.11tydata.js
Normal 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`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user