diff --git a/src/utils/generateOgImages.tsx b/src/utils/generateOgImages.tsx
index 328ab38..61b5bc9 100644
--- a/src/utils/generateOgImages.tsx
+++ b/src/utils/generateOgImages.tsx
@@ -1,8 +1,8 @@
import satori, { type SatoriOptions } from "satori";
-import { SITE } from "@config";
import { writeFile } from "node:fs/promises";
import { Resvg } from "@resvg/resvg-js";
import { getCollection } from "astro:content";
+import postOgImage from "./og-templates/post";
const fetchFonts = async () => {
// Regular Font
@@ -22,100 +22,6 @@ const fetchFonts = async () => {
const { fontRegular, fontBold } = await fetchFonts();
-const ogImage = (text: string) => {
- return (
-
-
-
-
-
-
- {text}
-
-
-
- by{" "}
-
- "
-
-
- {SITE.author}
-
-
-
-
- {SITE.title}
-
-
-
-
-
- );
-};
-
const options: SatoriOptions = {
width: 1200,
height: 630,
@@ -146,7 +52,7 @@ const generateOgImages = async () => {
);
const imageGenerationPromises = posts.map(async post => {
- const svg = await satori(ogImage(post.data.title), options);
+ const svg = await satori(postOgImage(post.data.title), options);
// render png in production mode
if (import.meta.env.MODE === "production") {
diff --git a/src/utils/og-templates/post.tsx b/src/utils/og-templates/post.tsx
new file mode 100644
index 0000000..480645c
--- /dev/null
+++ b/src/utils/og-templates/post.tsx
@@ -0,0 +1,95 @@
+import { SITE } from "@config";
+
+export default (text: string) => {
+ return (
+
+
+
+
+
+
+ {text}
+
+
+
+ by{" "}
+
+ "
+
+
+ {SITE.author}
+
+
+
+
+ {SITE.title}
+
+
+
+
+
+ );
+};