Skip to content

Commit 1521963

Browse files
committed
fix: og
1 parent 0618de2 commit 1521963

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

markdown/index.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
[
2-
{ "authors": ["yy"],
2+
{
3+
"authors": ["yy"],
34
"path": "yyblog.md",
45
"title": "yyblog",
56
"tag": "技术/react",
67
"coverImage": "https://p6-xtjj-sign.byteimg.com/tos-cn-i-73owjymdk6/0b76076eab124179816d68b846280cdc~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAgTWVnYXRyb25LaW5n:q75.awebp?rk3s=f64ab15b&x-expires=1731736114&x-signature=3ggdE9od5WvMZaVJ7VFlQtt48rA%3D"
78
},
8-
{ "authors": ["yy"],
9+
{
10+
"authors": ["yy"],
911
"path": "react19.md",
1012
"title": "react19",
1113
"tag": "随笔/生活",

src/app/(app)/notes/[nid]/page.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ export const generateMetadata = async ({ params }: { params: any }): Promise<Met
2727
const postData = postDataMap[nid];
2828
const { title, summary } = postData;
2929

30-
const ogParams = new URLSearchParams();
31-
ogParams.set('title', postData.title);
32-
ogParams.set('tag', postData.tag);
33-
3430
return {
3531
authors: postData.authors?.map((author) => ({
3632
name: author,
@@ -47,7 +43,7 @@ export const generateMetadata = async ({ params }: { params: any }): Promise<Met
4743
url: `/notes/${nid}`,
4844
images: [
4945
{
50-
url: `/api/og?${ogParams.toString()}`,
46+
url: `/api/og?title=${postData.title}&tag=${postData.tag}`,
5147
alt: postData.title,
5248
},
5349
],

src/app/layout.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ export const metadata: Metadata = {
3535
default: seo.title,
3636
template: '%s | zhw',
3737
},
38+
images: [
39+
{
40+
url: '/api/og',
41+
alt: 'zhw blog',
42+
},
43+
],
3844
description: seo.description,
3945
siteName: 'zhw blog',
4046
locale: 'zh_CN',

0 commit comments

Comments
 (0)