File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,28 +3,17 @@ import { source } from '@/lib/source';
33
44export const dynamic = 'force-static' ;
55
6- function getPages ( tree : any ) : any [ ] {
7- const pages : any [ ] = [ ] ;
8-
9- function traverse ( nodes : any [ ] ) {
10- for ( const node of nodes ) {
11- if ( node . type === 'page' ) {
12- pages . push ( node ) ;
13- } else if ( 'children' in node ) {
14- traverse ( node . children ) ;
15- }
16- }
17- }
18-
19- traverse ( tree . children ) ;
20- return pages ;
21- }
22-
236export default function sitemap ( ) : MetadataRoute . Sitemap {
24- const pages = getPages ( source . pageTree ) . map ( ( page ) => ( {
7+ // Get all pages from source.getPages() which combines all sources
8+ const allPages = source . getPages ( ) ;
9+
10+ // Map pages to sitemap entries
11+ const sitemapEntries = allPages . map ( ( page ) => ( {
2512 url : new URL ( page . url , 'https://docs.deploystack.io' ) . toString ( ) ,
26- lastModified : page . lastModified ,
13+ lastModified : page . data . lastModified ? new Date ( page . data . lastModified ) : undefined ,
14+ changeFrequency : 'weekly' as const ,
15+ priority : page . url === '/' ? 1.0 : page . url . startsWith ( '/development' ) || page . url . startsWith ( '/self-hosted' ) ? 0.7 : 0.8 ,
2716 } ) ) ;
2817
29- return pages ;
18+ return sitemapEntries ;
3019}
You can’t perform that action at this time.
0 commit comments