summaryrefslogtreecommitdiff
path: root/src/build/index.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'src/build/index.mjs')
-rw-r--r--src/build/index.mjs41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/build/index.mjs b/src/build/index.mjs
index 980e6cd..59c006e 100644
--- a/src/build/index.mjs
+++ b/src/build/index.mjs
@@ -18,6 +18,7 @@ const headerTmpl = fs.readFileSync("src/templates/header.tmpl", "utf8");
const articleTmpl = fs.readFileSync("src/templates/article.tmpl", "utf8");
const indexTmpl = fs.readFileSync("src/templates/index.tmpl", "utf8");
const notesTmpl = fs.readFileSync("src/templates/notes.tmpl", "utf8");
+const legalTmpl = fs.readFileSync("src/templates/legal.tmpl", "utf8");
const tagTmpl = fs.readFileSync("src/templates/tag.tmpl", "utf8");
const hidTmpl = fs.readFileSync("src/templates/hid.tmpl", "utf8");
const baseUrl = "https://ache.one/";
@@ -38,6 +39,7 @@ const listNotes = fs
.readdirSync("notes")
.filter((name) => name.endsWith(".md"));
const notesAll = loadMD(listNotes, "notes"); // lang is determined from the note
+const legalPages = loadMD(["legal.md", "legal-en.md"], "src/pages");
for (const lang in i18n) {
const tagsArticle = new Map();
@@ -192,6 +194,44 @@ for (const lang in i18n) {
});
}
+ // Legal page
+ {
+ const legal_page = legalPages.filter(
+ (page) => page.metaData.lang == lang,
+ )[0];
+ const alt_lang = {
+ fr: {
+ lang: "en",
+ url: "/en/",
+ },
+ en: {
+ lang: "fr",
+ url: "/fr/",
+ },
+ };
+ const context = {
+ page_title: i18n[lang].title.legal,
+ title: i18n[lang].title,
+ intro: i18n[lang].intro,
+ lang,
+ canonical: `${baseUrl}${lang}/legal`,
+ svg,
+ content: legal_page.content,
+ alt_lang: [alt_lang[lang]],
+ description: i18n[lang].index_desc,
+ };
+
+ console.log(`Create : Legal page ${lang}`);
+ const output = mustache.render(legalTmpl, context, partials);
+
+ fs.writeFileSync(`${lang}/legal.html`, minifyHTML(output));
+ links.push({
+ url: `${lang}/legal.html`,
+ changefreq: "yearly",
+ priority: 0.1,
+ });
+ }
+
// Home page
{
const alt_lang = {
@@ -229,7 +269,6 @@ for (const lang in i18n) {
}
console.log(`Create: sitemap.xml`);
-
// Create a stream to write to
const stream = new SitemapStream({ hostname: "https://ache.one" });