summaryrefslogtreecommitdiff
path: root/src/build
diff options
context:
space:
mode:
authorache <ache@ache.one>2024-08-12 02:12:19 +0200
committerache <ache@ache.one>2024-08-12 02:12:19 +0200
commit32b4ba93b0279af3b3bc15cd12625a66034c8153 (patch)
tree5018d1fb8e7d09b58a0c3ddc94103da910cd5032 /src/build
parentFormating whitespace (diff)
Support for legal notice
Diffstat (limited to 'src/build')
-rw-r--r--src/build/i18n.mjs2
-rw-r--r--src/build/index.mjs41
2 files changed, 42 insertions, 1 deletions
diff --git a/src/build/i18n.mjs b/src/build/i18n.mjs
index 00a554b..3f8c748 100644
--- a/src/build/i18n.mjs
+++ b/src/build/i18n.mjs
@@ -13,6 +13,7 @@ const i18n = {
git: "Dépôt git personnel",
mastodon: "Mon mastodon",
notes: "Notes",
+ legal: "Mentions légales",
},
articles: [
"framasoft-et-les-mascottes-du-libre.md",
@@ -60,6 +61,7 @@ const i18n = {
git: "Personnel git repository",
mastodon: "Mastodon account",
notes: "Notes",
+ legal: "Legal notice",
},
articles: [
"rail-and-advertising.md",
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" });