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.mjs47
1 files changed, 45 insertions, 2 deletions
diff --git a/src/build/index.mjs b/src/build/index.mjs
index 26d2067..980e6cd 100644
--- a/src/build/index.mjs
+++ b/src/build/index.mjs
@@ -17,6 +17,7 @@ const likesTmpl = fs.readFileSync("src/templates/likes.tmpl", "utf8");
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 tagTmpl = fs.readFileSync("src/templates/tag.tmpl", "utf8");
const hidTmpl = fs.readFileSync("src/templates/hid.tmpl", "utf8");
const baseUrl = "https://ache.one/";
@@ -49,9 +50,16 @@ for (const lang in i18n) {
// Same for notes
const notes = notesAll.filter((note) => note.metaData.lang == lang);
-
const material = [...articles, ...notes];
+ // Make notes directory
+ try {
+ fs.mkdirSync(`${lang}/notes`, { recursive: true });
+ } catch {
+ fs.rmSync(`${lang}/notes`, { force: true, recursive: true });
+ fs.mkdirSync(`${lang}/notes`, { recursive: true });
+ }
+
for (const post of material) {
const context = {
svg,
@@ -149,7 +157,7 @@ for (const lang in i18n) {
});
}
- // Home page
+ // Notes page: A note with a list of every note in that language
{
const alt_lang = {
fr: {
@@ -168,6 +176,41 @@ for (const lang in i18n) {
lang,
canonical: `${baseUrl}${lang}`,
svg,
+ notes,
+ alt_lang: [alt_lang[lang]],
+ description: i18n[lang].index_desc,
+ };
+
+ console.log(`Create : Notes page ${lang}`);
+ const output = mustache.render(notesTmpl, context, partials);
+ fs.writeFileSync(`${lang}/notes/index.html`, minifyHTML(output));
+ links.push({
+ url: `${baseUrl}${lang}/notes`,
+ changefreq: "monthly",
+ priority: 0.7,
+ img: [{ url: "https://ache.one/res/ache.svg" }],
+ });
+ }
+
+ // Home page
+ {
+ const alt_lang = {
+ fr: {
+ lang: "en",
+ url: "/en/",
+ },
+ en: {
+ lang: "fr",
+ url: "/fr/",
+ },
+ };
+ const context = {
+ page_title: i18n[lang].title.notes,
+ title: i18n[lang].title,
+ intro: i18n[lang].intro,
+ lang,
+ canonical: `${baseUrl}${lang}/notes`,
+ svg,
articles,
alt_lang: [alt_lang[lang]],
description: i18n[lang].index_desc,