File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ import type { MetadataRoute } from 'next' ;
2
+ import { source } from '@/lib/source' ;
3
+
4
+ export const revalidate = false ;
5
+
6
+ export default async function sitemap ( ) : Promise < MetadataRoute . Sitemap > {
7
+ const url = ( path : string ) : string => new URL ( path , process . env . NEXT_PUBLIC_BASE_URL ) . toString ( ) ;
8
+
9
+ return [
10
+ {
11
+ url : url ( '/' ) ,
12
+ changeFrequency : 'monthly' ,
13
+ priority : 1 ,
14
+ } ,
15
+ {
16
+ url : url ( '/docs' ) ,
17
+ changeFrequency : 'monthly' ,
18
+ priority : 0.8 ,
19
+ } ,
20
+ ...( await Promise . all (
21
+ source . getPages ( ) . map ( async ( page ) => {
22
+ return {
23
+ url : url ( page . url ) ,
24
+ lastModified : page . data . lastModified ? new Date ( page . data . lastModified ) : undefined ,
25
+ changeFrequency : 'weekly' ,
26
+ priority : 0.5 ,
27
+ } as MetadataRoute . Sitemap [ number ] ;
28
+ } ) ,
29
+ ) ) ,
30
+ ] ;
31
+ }
You can’t perform that action at this time.
0 commit comments