File tree Expand file tree Collapse file tree
src/app/[locale]/sitemap.xml Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,17 +2,24 @@ import { NextResponse } from 'next/server';
22import { getAllPosts } from '@/lib/markdown' ;
33import { headers } from 'next/headers' ;
44
5- const staticRoutes = [
6- '' , // home
7- 'about' ,
8- 'contact' ,
9- 'impressum' ,
10- 'newsletter' ,
11- 'posts' ,
12- 'support-care' ,
13- 'support-care-maven' ,
14- 'updates' ,
15- ] ;
5+ function getStaticRoutes ( locale : string ) : string [ ] {
6+ const routes = [
7+ '' , // home
8+ 'about' ,
9+ 'contact' ,
10+ 'impressum' ,
11+ 'posts' ,
12+ 'support-care' ,
13+ 'support-care-maven' ,
14+ 'updates' ,
15+ ] ;
16+
17+ if ( locale === 'de' ) {
18+ routes . push ( 'newsletter' , 'newsletter-archive' ) ;
19+ }
20+
21+ return routes ;
22+ }
1623
1724export async function GET (
1825 request : Request ,
@@ -30,7 +37,7 @@ export async function GET(
3037 const allUrls : Array < { loc : string ; lastmod : string } > = [ ] ;
3138
3239 // Add static routes
33- for ( const route of staticRoutes ) {
40+ for ( const route of getStaticRoutes ( locale ) ) {
3441 const path = route ? `${ localePrefix } /${ route } ` : localePrefix ;
3542 allUrls . push ( {
3643 loc : `${ baseUrl } ${ path } ` ,
You can’t perform that action at this time.
0 commit comments