File tree Expand file tree Collapse file tree 8 files changed +32
-1
lines changed Expand file tree Collapse file tree 8 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 1
1
export const seo = {
2
- title : 'zhw | fe ' ,
2
+ title : 'home | zhw ' ,
3
3
description : '我是zhw,欢迎来到我的博客' ,
4
4
url : new URL (
5
5
process . env . NODE_ENV === 'production'
Original file line number Diff line number Diff line change 9
9
"path" : " react19.md" ,
10
10
"title" : " react19" ,
11
11
"tag" : " 随笔/生活" ,
12
+ "summary" : " 这篇文章记录了react19相关的一些内容" ,
12
13
"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"
13
14
}
14
15
]
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { NormalContainer } from '@/components/layout/container/Normal';
5
5
6
6
export const metadata : Metadata = {
7
7
title : '关于我' ,
8
+ description : '但愿人长久,千里共婵娟' ,
8
9
} ;
9
10
10
11
export default async function ( props : PropsWithChildren ) {
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { NormalContainer } from '@/components/layout/container/Normal';
5
5
6
6
export const metadata : Metadata = {
7
7
title : '朋友们' ,
8
+ description : '海内存知己,天涯若比邻' ,
8
9
} ;
9
10
10
11
export default async function ( props : PropsWithChildren ) {
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
+ import { Metadata } from 'next' ;
2
3
3
4
import AnimatedPostItem from './AnimatedPostItem' ;
4
5
5
6
import { NormalContainer } from '@/components/layout/container/Normal' ;
6
7
import { buildPostData } from '@/core' ;
7
8
9
+ export const metadata : Metadata = {
10
+ title : '文稿' ,
11
+ description : '文章列表' ,
12
+ } ;
13
+
8
14
const ArticleList : React . FC = ( ) => {
9
15
const { postDataList } = buildPostData ( ) ;
10
16
Original file line number Diff line number Diff line change 1
1
'use server' ;
2
2
3
+ import { Metadata } from 'next' ;
4
+
3
5
import {
4
6
NoteTitle ,
5
7
NoteDateMeta ,
@@ -18,6 +20,22 @@ const { postDataMap } = buildPostData();
18
20
19
21
export type PageInnerProps = { postData : PostItemType } ;
20
22
23
+ export const generateMetadata = async ( { params } : { params : any } ) : Promise < Metadata > => {
24
+ try {
25
+ const { nid } = params ;
26
+
27
+ const postData = postDataMap [ nid ] ;
28
+ const { title, summary } = postData ;
29
+
30
+ return {
31
+ title : { absolute : title } ,
32
+ description : summary ,
33
+ } satisfies Metadata ;
34
+ } catch {
35
+ return { } ;
36
+ }
37
+ } ;
38
+
21
39
export default async function Page ( { params } : { params : Record < string , any > } ) {
22
40
const { nid } = params ;
23
41
const postData = postDataMap [ nid ] ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { NormalContainer } from '@/components/layout/container/Normal';
5
5
6
6
export const metadata : Metadata = {
7
7
title : '看看我在做啥' ,
8
+ description : '一些小玩具' ,
8
9
} ;
9
10
10
11
export default async function ( props : PropsWithChildren ) {
Original file line number Diff line number Diff line change @@ -16,13 +16,15 @@ export type PostItem = {
16
16
createdAt : Date | null ;
17
17
modified : boolean ;
18
18
coverImage : string ;
19
+ summary ?: string ;
19
20
} ;
20
21
21
22
export type PostJsonType = {
22
23
path : string ;
23
24
title : string ;
24
25
tag : string ;
25
26
coverImage : string ;
27
+ summary ?: string ;
26
28
} ;
27
29
export type PostMap = Record < string , PostItem > ;
28
30
@@ -44,6 +46,7 @@ export function buildPostData() {
44
46
itemInfo . tag = item . tag ;
45
47
itemInfo . path = item . path . replace ( '.md' , '' ) ;
46
48
itemInfo . rawFilePath = `./${ item . path } ` ;
49
+ itemInfo . summary = item . summary ;
47
50
itemInfo . coverImage = item . coverImage . startsWith ( 'http' )
48
51
? item . coverImage
49
52
: `/postCoverImage/${ item . coverImage } ` ;
You can’t perform that action at this time.
0 commit comments