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 { apiSource , source } from '../../../lib/source' ;
2+
3+ export const GET = async ( ) => {
4+ const rootUrl = "https://docs.stack-auth.com" ;
5+
6+ // Get pages from both sources
7+ const docsPages = source . getPages ( ) ;
8+ const apiPages = apiSource . getPages ( ) ;
9+ const allPages = [ ...docsPages , ...apiPages ] ;
10+
11+ const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
12+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
13+ ${ allPages
14+ . map ( ( page ) => {
15+ const url = new URL ( page . url , rootUrl ) ;
16+ return ` <url>
17+ <loc>${ url . toString ( ) } </loc>
18+ <changefreq>weekly</changefreq>
19+ <priority>0.8</priority>
20+ </url>` ;
21+ } )
22+ . join ( "\n" ) }
23+ </urlset>` ;
24+
25+ return new Response ( sitemap , {
26+ headers : {
27+ "Content-Type" : "application/xml" ,
28+ "Cache-Control" : "public, max-age=3600" ,
29+ } ,
30+ } ) ;
31+ } ;
You can’t perform that action at this time.
0 commit comments