Skip to content

Commit 71b9b8a

Browse files
committed
docs: Dynamic og also for home page
1 parent fe949a5 commit 71b9b8a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

docs/pages/api/og.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ export default async function OG(req: Request) {
117117
style={{
118118
fontSize: 82,
119119
lineHeight: 1.1,
120-
letterSpacing: -4
120+
letterSpacing: -4,
121+
marginRight: 12
121122
}}
122123
>
123124
{title}

docs/public/og-image.png

-33.8 KB
Binary file not shown.

docs/theme.config.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,9 @@ export default {
103103
const pageConfig = useConfig();
104104
const {route} = useRouter();
105105
const isDefault = route === '/' || !pageConfig.title;
106-
107-
const image = isDefault
108-
? '/og-image.png'
109-
: `/api/og?title=${pageConfig.title}`;
106+
const image = `/api/og?title=${
107+
isDefault ? config.description : pageConfig.title
108+
}`;
110109

111110
const description =
112111
pageConfig.frontMatter.description ||

0 commit comments

Comments
 (0)