File tree Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export const metadata: Metadata = {
29
29
'max-image-preview' : 'large' ,
30
30
'max-snippet' : - 1 ,
31
31
} ,
32
- } , //爬虫
32
+ } ,
33
33
openGraph : {
34
34
title : {
35
35
default : seo . title ,
Original file line number Diff line number Diff line change
1
+ import type { MetadataRoute } from 'next' ;
2
+
3
+ import { siteUrl } from '~/seo' ;
4
+
5
+ export default function robots ( ) : MetadataRoute . Robots {
6
+ return {
7
+ rules : [
8
+ {
9
+ userAgent : '*' ,
10
+ allow : '/' ,
11
+ disallow : [ '/og' ] ,
12
+ } ,
13
+ ] ,
14
+ sitemap : `${ siteUrl } /sitemap.xml` ,
15
+ } ;
16
+ }
Original file line number Diff line number Diff line change
1
+ import { MetadataRoute } from 'next' ;
2
+
3
+ import { siteUrl } from '~/seo' ;
4
+ import { buildPostData } from '@/core' ;
5
+
6
+ const { postDataList } = buildPostData ( ) ;
7
+
8
+ export default function sitemap ( ) : MetadataRoute . Sitemap {
9
+ const postSitemap = postDataList . map ( ( post ) => ( {
10
+ url : `${ siteUrl } /notes/${ post . title } ` ,
11
+ lastModified : post . updatedAt ! ,
12
+ } ) ) ;
13
+
14
+ return [
15
+ { url : `${ siteUrl } ` } ,
16
+ { url : `${ siteUrl } /list` } ,
17
+ { url : `${ siteUrl } /friends` } ,
18
+ { url : `${ siteUrl } /about` } ,
19
+ { url : `${ siteUrl } /projects` } ,
20
+ ...postSitemap ,
21
+ ] ;
22
+ }
You can’t perform that action at this time.
0 commit comments