diff --git a/pages/thoughts.html b/pages/thoughts.html
index bcb92e4..a7e7acd 100644
--- a/pages/thoughts.html
+++ b/pages/thoughts.html
@@ -10,24 +10,11 @@
A peak inside my brain you ask? Reader, beware...
-
- We all know that monitoring and alerting are important, right? But
- just how important do we really think they are? How much do we show
- that in what we do?
-
-
- This is a story about an experience I had at a previous company, where
- I had the pleasure of being at least partially responsible for the
- system going down, and what we learned.
-
- Read the rest
+ {body0}
+ Read the rest
diff --git a/scripts/generateThoughts.ts b/scripts/generateThoughts.ts
index e00e0ce..2630b71 100644
--- a/scripts/generateThoughts.ts
+++ b/scripts/generateThoughts.ts
@@ -30,17 +30,22 @@ const articles = findInDir("./thoughts/articles", ".md");
const mdConverter = new showdown.Converter();
-const articlesGenerated = [];
+const articlesGenerated: Array<{
+ title: string;
+ link: string;
+ body: string;
+ date: string;
+}> = [];
articles.forEach((article) => {
const articleWithoutFolder = article
.replace("thoughts/articles/", "")
.replace(".md", ".html");
- let [datestring, title] = articleWithoutFolder
+ let [datestring, titleWithDash] = articleWithoutFolder
.replace(".html", "")
.split("_");
const date = dateFormat(new Date(datestring), "do LLL, u");
- title = title.replace(/-/g, " ");
+ const title = titleWithDash.replace(/-/g, " ");
const body = mdConverter.makeHtml(fs.readFileSync(article, "utf8"));
const articleContents = thoughtsPageTemplateContents
@@ -55,13 +60,31 @@ articles.forEach((article) => {
"utf8"
);
+ const splitBody = body.split("");
+
articlesGenerated.push({
+ link: `${datestring}_${titleWithDash}`,
title,
date,
- body,
+ body: `${splitBody[0]}${splitBody[1]}`,
});
});
console.log(`Generated ${articlesGenerated.length} articles`);
+console.log("Updating thoughts page proper");
+let thoughtsPageContents = fs.readFileSync("./public/thoughts.html", "utf8");
+
+for (let i = 0; i < Math.min(2, articlesGenerated.length); i++) {
+ thoughtsPageContents = thoughtsPageContents
+ .replace(`{title${i}}`, articlesGenerated[i].title)
+ .replace(`{date${i}}`, articlesGenerated[i].date)
+ .replace(`{body${i}}`, articlesGenerated[i].body)
+ .replace(`{link${i}}`, articlesGenerated[i].link);
+}
+
+console.log("Updated thoughts page");
+
+fs.writeFileSync("./public/thoughts.html", thoughtsPageContents, "utf8");
+
console.log("/// Finished generation of thoughts");