Skip to content

Commit aa78476

Browse files
committed
fix: Modify descriptions for each page/article
1 parent 0f5a990 commit aa78476

4 files changed

Lines changed: 36 additions & 18 deletions

File tree

scripts/generatePages.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ pages.forEach((page) => {
1515
pageName = "home";
1616
}
1717

18+
let description = "I'm James King, and I make things for the web";
19+
switch (pageName) {
20+
case "thoughts":
21+
description = "A peak inside my brain you ask? Reader, beware...";
22+
break;
23+
case "profile":
24+
description =
25+
"So who am I? I'm James King, a 27 year old Software Engineer from Lincolnshire. You want some more info?";
26+
break;
27+
case "coding":
28+
description = "Shall we take a look at some projects I've done?";
29+
break;
30+
default:
31+
// do nothing - already set description for home/index
32+
}
33+
1834
templates.forEach((template) => {
1935
const templateContents = fs
2036
.readFileSync(template, "utf8")
@@ -25,7 +41,8 @@ pages.forEach((page) => {
2541
new RegExp(`{${template.replace("templates/", "")}}`, "g"),
2642
templateContents
2743
)
28-
.replace("{subpage}", "");
44+
.replace(/{subpage}/g, "")
45+
.replace(/{description}/g, description);
2946
});
3047

3148
fs.writeFileSync(page.replace("pages/", "public/"), pageContents, "utf8");

scripts/generateThoughts.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let thoughtsPageTemplateContents = fs.readFileSync(
1717
templates.forEach((template) => {
1818
const templateContents = fs
1919
.readFileSync(template, "utf8")
20-
.replace(new RegExp(`{page}`, "g"), "thoughts");
20+
.replace(/{page}/g, "thoughts");
2121

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

51+
const splitBody = body.split("</p>");
52+
5153
const articleContents = thoughtsPageTemplateContents
5254
.replace("{title}", title)
5355
.replace("{date}", date)
5456
.replace("{body}", body)
55-
.replace("thoughts {subpage}", `${title}`);
57+
.replace(/thoughts {subpage}/g, `${title}`)
58+
.replace(
59+
/{description}/g,
60+
`${splitBody[0]} ${splitBody[1]}`
61+
.replace(/\<(.*?)\>/g, "")
62+
.replace("\n", "")
63+
);
64+
5665
console.log(`Found article ${title} published ${date}`);
5766
fs.writeFileSync(
5867
`public/thoughts/${articleWithoutFolder}`,
5968
articleContents,
6069
"utf8"
6170
);
6271

63-
const splitBody = body.split("</p>");
64-
6572
articlesGenerated.push({
6673
link: `${datestring}_${titleWithDash}`,
6774
title,

templates/head.html

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,14 @@
1818
<meta charset="utf-8" />
1919

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

2825
<!-- Social sharing meta -->
29-
<meta property="og:title" content="ripixel | {page}" />
26+
<meta property="og:title" content="{page} {subpage}" />
3027
<meta property="og:site_name" content="ripixel.co.uk" />
31-
<meta
32-
property="og:description"
33-
content="I'm James King, and I make things for the web"
34-
/>
28+
<meta property="og:description" content="{description}" />
3529
<meta
3630
property="og:image"
3731
content="https://www.ripixel.co.uk/card_{page}.png"

thoughts/articles/2019-09-09_The-Importance-of-Monitoring-and-Alerting.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
_This thought was first published on the [DVELP blog](https://dvelp.co.uk/articles/monitoring-and-alerting) - but it was still written by me!_
2-
31
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?
42

5-
## What happened?
6-
73
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.
84

5+
## What happened?
6+
97
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.
108

119
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...
@@ -72,3 +70,5 @@ So, some takeaways from my (traumatic) trip down memory lane about how I took do
7270
- Data is only important if you use it
7371
- Graphs and alerts are really boring until _they save you_
7472
- Give developers time to make "of no immediate value" things like monitoring and alerting, and make it part of any Acceptance into Service checklists
73+
74+
_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 commit comments

Comments
 (0)