Skip to content

Commit a0aca87

Browse files
Add dynamic Open Graph image handling and dependencies
Introduce `duendeOpenGraphImage` component for generating Open Graph images dynamically. Update `package.json` with required dependencies like `astro-opengraph-images`, `tw-to-css`, and React-related packages. #658
1 parent 63dfbad commit a0aca87

8 files changed

Lines changed: 2108 additions & 101 deletions

File tree

astro.config.mjs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import rehypeAutolinkHeadings from "rehype-autolink-headings";
1111
import starlightHeadingBadges from "starlight-heading-badges";
1212
import starlightLlmsTxt from "starlight-llms-txt";
1313
import rehypeAstroRelativeMarkdownLinks from "astro-rehype-relative-markdown-links";
14+
import opengraphImages from "astro-opengraph-images";
15+
import { duendeOpenGraphImage } from "./src/components/duende-og-image.js";
16+
import * as fs from "node:fs";
1417

1518
// https://astro.build/config
1619
export default defineConfig({
@@ -123,6 +126,7 @@ export default defineConfig({
123126
components: {
124127
SkipLink: "./src/components/SkipLink.astro",
125128
Banner: "./src/components/Banner.astro",
129+
Head: "./src/components/Head.astro",
126130
},
127131
sidebar: [
128132
{
@@ -162,6 +166,21 @@ export default defineConfig({
162166
redirectFrom({
163167
contentDir: "./src/content/docs",
164168
}),
169+
opengraphImages({
170+
options: {
171+
fonts: [
172+
{
173+
name: "Roboto",
174+
weight: 400,
175+
style: "normal",
176+
data: fs.readFileSync(
177+
"node_modules/@fontsource/roboto/files/roboto-latin-400-normal.woff",
178+
),
179+
},
180+
],
181+
},
182+
render: duendeOpenGraphImage,
183+
}),
165184
],
166185
markdown: {
167186
rehypePlugins: [

0 commit comments

Comments
 (0)