File tree Expand file tree Collapse file tree 3 files changed +346
-125
lines changed
Expand file tree Collapse file tree 3 files changed +346
-125
lines changed Original file line number Diff line number Diff line change @@ -17,42 +17,58 @@ export async function generateMetadata({
1717} : UserProfilePageProps ) : Promise < Metadata > {
1818 const { uid } = await params ;
1919 const uidNumber = parseInt ( uid , 10 ) ;
20+ const pathname = `/user/${ uid } ` ;
2021
2122 if ( isNaN ( uidNumber ) ) {
22- return generateSEOMetadata ( {
23- title : "用户不存在" ,
24- robots : {
25- index : false ,
26- follow : false ,
23+ return generateSEOMetadata (
24+ {
25+ title : "用户不存在" ,
26+ robots : {
27+ index : false ,
28+ follow : false ,
29+ } ,
30+ } ,
31+ {
32+ pathname,
2733 } ,
28- } ) ;
34+ ) ;
2935 }
3036
3137 // 获取用户基本信息
3238 const profileResult = await getUserPublicProfile ( uidNumber ) ;
3339
3440 if ( ! profileResult . success || ! profileResult . data ) {
35- return generateSEOMetadata ( {
36- title : "用户不存在" ,
37- robots : {
38- index : false ,
39- follow : false ,
41+ return generateSEOMetadata (
42+ {
43+ title : "用户不存在" ,
44+ robots : {
45+ index : false ,
46+ follow : false ,
47+ } ,
48+ } ,
49+ {
50+ pathname,
4051 } ,
41- } ) ;
52+ ) ;
4253 }
4354
4455 const { user } = profileResult . data ;
4556 const displayName = user . nickname || user . username ;
4657
47- return generateSEOMetadata ( {
48- title : `${ displayName } 的个人主页` ,
49- description :
50- user . bio || `查看 ${ displayName } 的个人资料、文章、评论和活动记录` ,
51- robots : {
52- index : false , // 不索引用户档案页
53- follow : false ,
58+ return generateSEOMetadata (
59+ {
60+ title : `${ displayName } 的个人主页` ,
61+ description :
62+ user . bio || `查看 ${ displayName } 的个人资料、文章、评论和活动记录` ,
63+ robots : {
64+ index : false , // 不索引用户档案页
65+ follow : false ,
66+ } ,
5467 } ,
55- } ) ;
68+ {
69+ pathname,
70+ } ,
71+ ) ;
5672}
5773
5874export default async function UserProfilePage ( {
Original file line number Diff line number Diff line change @@ -8,11 +8,20 @@ import ClientDiagnostics from "@/components/ui/ClientDiagnostics";
88import LinkButton from "@/components/ui/LinkButton" ;
99import { generateMetadata } from "@/lib/server/seo" ;
1010
11- export const metadata = await generateMetadata ( {
12- title : "404 Not Found" ,
13- description :
14- "在服务器中未找到此页面。这可能代表此页面已被删除、移动,或从未存在过。" ,
15- } ) ;
11+ export const metadata = await generateMetadata (
12+ {
13+ title : "404 Not Found" ,
14+ description :
15+ "在服务器中未找到此页面。这可能代表此页面已被删除、移动,或从未存在过。" ,
16+ robots : {
17+ index : false ,
18+ follow : false ,
19+ } ,
20+ } ,
21+ {
22+ pathname : "/404" ,
23+ } ,
24+ ) ;
1625
1726export default function NotFoundPage ( ) {
1827 return (
You can’t perform that action at this time.
0 commit comments