Add misc section with full per-page strings translation support, 88x31 page and bookmarks page.
This commit is contained in:
parent
45aa627911
commit
74285e314d
89 changed files with 291 additions and 9 deletions
34
misc/misc.11tydata.js
Normal file
34
misc/misc.11tydata.js
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
module.exports = {
|
||||
eleventyComputed: {
|
||||
t: (data) => {
|
||||
const dir = path.dirname(data.page.inputPath);
|
||||
|
||||
const file = path.join(dir, `${data.langKey}.json`);
|
||||
if (fs.existsSync(file)) {
|
||||
return JSON.parse(fs.readFileSync(file, "utf-8"));
|
||||
}
|
||||
|
||||
return {};
|
||||
},
|
||||
c: (data) => {
|
||||
const dir = path.dirname(data.page.inputPath);
|
||||
|
||||
const file = path.join(dir, `common.json`);
|
||||
if (fs.existsSync(file)) {
|
||||
return JSON.parse(fs.readFileSync(file, "utf-8"));
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
languages: ["en", "pt"],
|
||||
permalink: data => {
|
||||
return `/${data.langKey}/misc/${data.page.fileSlug}/`;
|
||||
},
|
||||
tags: "misc"
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue