Skip to content

Commit 087c8ed

Browse files
committed
feat: add experimental og-image generation
1 parent 21aa3fe commit 087c8ed

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

bun.lockb

1.16 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"@astrojs/solid-js": "^5.0.4",
1818
"@fontsource-variable/jetbrains-mono": "^5.1.2",
1919
"astro": "^5.1.8",
20+
"astro-og-canvas": "^0.5.6",
2021
"graphql-request": "^7.1.2",
2122
"solid-js": "^1.9.4"
2223
},

src/content/pages/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: TheComputerM
44

55
## Hey there
66

7-
I am Mudit Somani aka TheComputerM. I'm currently a student at [BITS Pilani](https://www.bits-pilani.ac.in/hyderabad/) studying computer science. I love to code and learn how various technologies function. I occasionally blog about things which I find interesting and/or helpful. I read books and play badminton in my spare time.
7+
I am Mudit Somani aka TheComputerM. I'm currently a student at [BITS Pilani](https://www.bits-pilani.ac.in/hyderabad/) studying computer science. I love to code and learn how various technologies function. I occasionally [blog](/blog) about things which I find interesting and/or helpful. I read books and play badminton in my spare time.
88

99
## About Me
1010

src/pages/open-graph/[...route].ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { OGImageRoute } from "astro-og-canvas";
2+
3+
const pages = {
4+
blog: {
5+
title: "Blog",
6+
description: "The latest blog posts from Astro",
7+
},
8+
};
9+
10+
11+
export const { getStaticPaths, GET } = OGImageRoute({
12+
param: "route",
13+
pages: pages,
14+
getImageOptions(path, page) {
15+
console.log(path);
16+
return {
17+
title: page.title,
18+
description: page.description,
19+
fonts: ["https://cdn.jsdelivr.net/fontsource/fonts/ibm-plex-mono@latest/latin-500-normal.ttf"],
20+
font: {
21+
title: {
22+
families: ["IBM Plex Mono"],
23+
}
24+
}
25+
};
26+
},
27+
});

0 commit comments

Comments
 (0)