the home site for me: also iteration 3 or 4 of my site

chore: only display author if a blog post

Changed files
+7 -3
static
pfp
tags
archival
essays
hilton
meta
reverse-engineering
teardown
tutorial
verify
tools
static/og.png

This is a binary file and will not be displayed.

static/pfp/og.png

This is a binary file and will not be displayed.

static/tags/archival/og.png

This is a binary file and will not be displayed.

static/tags/essays/og.png

This is a binary file and will not be displayed.

static/tags/hilton/og.png

This is a binary file and will not be displayed.

static/tags/meta/og.png

This is a binary file and will not be displayed.

static/tags/og.png

This is a binary file and will not be displayed.

static/tags/reverse-engineering/og.png

This is a binary file and will not be displayed.

static/tags/teardown/og.png

This is a binary file and will not be displayed.

static/tags/tutorial/og.png

This is a binary file and will not be displayed.

static/verify/og.png

This is a binary file and will not be displayed.

+6 -2
tools/genOG.ts
···
async function og(
postname: string,
type: string,
+
by: string | undefined,
outputPath: string,
width = 1200,
height = 630,
···
template
.toString()
.replace("{{postname}}", postname)
-
.replace("{{type}}", type),
+
.replace("{{type}}", type)
+
.replace("{{by}}", by || ""),
);
await page.screenshot({ path: outputPath });
···
const index = await Bun.file(`public/${file}`).text();
const title = index.match(/<title>(.*?)<\/title>/)[1];
let type = "Page";
+
let by: string | undefined;
switch (file.split("/")[0]) {
case "blog":
type = "Blog";
+
by = "<p>By Kieran Klukas</p>";
break;
case "verify":
case "pfp":
···
}
console.log("Generating OG for", file, "title:", title, "with type:", type);
-
await og(title, type, `static/${file.replace("index.html", "og.png")}`);
+
await og(title, type, by, `static/${file.replace("index.html", "og.png")}`);
}
} catch (e) {
console.error(e);
+1 -1
tools/og.html
···
<div>
<h1>{{type}}</h1>
<h2>{{postname}}</h2>
-
<p>By Kieran Klukas</p>
+
{{by}}
</div>
</body>
</html>