Skip to content

Commit

Permalink
fix: Modify descriptions for each page/article
Browse files Browse the repository at this point in the history
  • Loading branch information
ripixel committed Jun 6, 2020
1 parent 0f5a990 commit aa78476
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 18 deletions.
19 changes: 18 additions & 1 deletion scripts/generatePages.ts
Expand Up @@ -15,6 +15,22 @@ pages.forEach((page) => {
pageName = "home";
}

let description = "I'm James King, and I make things for the web";
switch (pageName) {
case "thoughts":
description = "A peak inside my brain you ask? Reader, beware...";
break;
case "profile":
description =
"So who am I? I'm James King, a 27 year old Software Engineer from Lincolnshire. You want some more info?";
break;
case "coding":
description = "Shall we take a look at some projects I've done?";
break;
default:
// do nothing - already set description for home/index
}

templates.forEach((template) => {
const templateContents = fs
.readFileSync(template, "utf8")
Expand All @@ -25,7 +41,8 @@ pages.forEach((page) => {
new RegExp(`{${template.replace("templates/", "")}}`, "g"),
templateContents
)
.replace("{subpage}", "");
.replace(/{subpage}/g, "")
.replace(/{description}/g, description);
});

fs.writeFileSync(page.replace("pages/", "public/"), pageContents, "utf8");
Expand Down
15 changes: 11 additions & 4 deletions scripts/generateThoughts.ts
Expand Up @@ -17,7 +17,7 @@ let thoughtsPageTemplateContents = fs.readFileSync(
templates.forEach((template) => {
const templateContents = fs
.readFileSync(template, "utf8")
.replace(new RegExp(`{page}`, "g"), "thoughts");
.replace(/{page}/g, "thoughts");

thoughtsPageTemplateContents = thoughtsPageTemplateContents.replace(
new RegExp(`{${template.replace("templates/", "")}}`, "g"),
Expand Down Expand Up @@ -48,20 +48,27 @@ articles.forEach((article) => {
const title = titleWithDash.replace(/-/g, " ");
const body = mdConverter.makeHtml(fs.readFileSync(article, "utf8"));

const splitBody = body.split("</p>");

const articleContents = thoughtsPageTemplateContents
.replace("{title}", title)
.replace("{date}", date)
.replace("{body}", body)
.replace("thoughts {subpage}", `${title}`);
.replace(/thoughts {subpage}/g, `${title}`)
.replace(
/{description}/g,
`${splitBody[0]} ${splitBody[1]}`
.replace(/\<(.*?)\>/g, "")
.replace("\n", "")
);

console.log(`Found article ${title} published ${date}`);
fs.writeFileSync(
`public/thoughts/${articleWithoutFolder}`,
articleContents,
"utf8"
);

const splitBody = body.split("</p>");

articlesGenerated.push({
link: `${datestring}_${titleWithDash}`,
title,
Expand Down
12 changes: 3 additions & 9 deletions templates/head.html
Expand Up @@ -18,20 +18,14 @@
<meta charset="utf-8" />

<title>ripixel | {page} {subpage}</title>
<meta
name="description"
content="I'm James King, and I make things for the web"
/>
<meta name="description" content="{description}" />
<meta name="author" content="James King" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<!-- Social sharing meta -->
<meta property="og:title" content="ripixel | {page}" />
<meta property="og:title" content="{page} {subpage}" />
<meta property="og:site_name" content="ripixel.co.uk" />
<meta
property="og:description"
content="I'm James King, and I make things for the web"
/>
<meta property="og:description" content="{description}" />
<meta
property="og:image"
content="https://www.ripixel.co.uk/card_{page}.png"
Expand Down
@@ -1,11 +1,9 @@
_This thought was first published on the [DVELP blog](https://dvelp.co.uk/articles/monitoring-and-alerting) - but it was still written by me!_

We all know that monitoring and alerting are important, right? But just _how_ important do we really think that? How much do we show that in what we do?

## What happened?

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.

## What happened?

As some scene-setting - we had to implement a service that would be accessed anytime a user visited the site. I did the work, got it reviewed, tested, and hey-presto, got it live. More testing, ensure nothing went bang, and went home.

The next morning, I return to work, and all is well. About 3 hours in the site goes down. _Panic!_ Time to follow the steps...
Expand Down Expand Up @@ -72,3 +70,5 @@ So, some takeaways from my (traumatic) trip down memory lane about how I took do
- Data is only important if you use it
- Graphs and alerts are really boring until _they save you_
- Give developers time to make "of no immediate value" things like monitoring and alerting, and make it part of any Acceptance into Service checklists

_This thought was first published on the [DVELP blog](https://dvelp.co.uk/articles/monitoring-and-alerting) - but it was still written by me!_

0 comments on commit aa78476

Please sign in to comment.