diff --git a/website/src/.vitepress/config/hooks/generateOgImages.ts b/website/src/.vitepress/config/hooks/generateOgImages.ts index a5fd3321..de058125 100644 --- a/website/src/.vitepress/config/hooks/generateOgImages.ts +++ b/website/src/.vitepress/config/hooks/generateOgImages.ts @@ -61,6 +61,18 @@ interface GenerateImagesOptions { fonts: SatoriOptions["fonts"] } +function getDir(url: string) { + if (url.startsWith("/docs/faq/")) { + return "FAQ" + } else if (url.startsWith("/docs/guides/")) { + return "Guide" + } else if (url.startsWith("/news/") && url !== "/news/") { + return "News" + } + + return undefined +} + async function generateImage({ page, template, outDir, fonts }: GenerateImagesOptions) { const { frontmatter, url } = page @@ -77,7 +89,7 @@ async function generateImage({ page, template, outDir, fonts }: GenerateImagesOp frontmatter.layout === "home" ? frontmatter.hero.tagline ?? frontmatter.description : frontmatter.description, - dir: url.startsWith("/docs/faq/") ? "FAQ" : url.startsWith("/docs/guides/") ? "Guide" : undefined, + dir: getDir(url), }, } diff --git a/website/src/.vitepress/theme/components/OgImageTemplate.vue b/website/src/.vitepress/theme/components/OgImageTemplate.vue index d9f38f98..efa2d07e 100644 --- a/website/src/.vitepress/theme/components/OgImageTemplate.vue +++ b/website/src/.vitepress/theme/components/OgImageTemplate.vue @@ -16,20 +16,15 @@ defineProps<{ title: string; description?: string; dir?: string }>()
-
- {{ dir }} -
+
+
-
- {{ title }} -
-
- {{ description }} -
+
+