Skip to content

Commit 0639cc9

Browse files
committed
refactor: improve shortcode handling and parsing logic
Signed-off-by: Daniel Ntege <danientege785@gmail.com>
1 parent 6836d94 commit 0639cc9

1 file changed

Lines changed: 19 additions & 12 deletions

File tree

src/app/[locale]/sitemap.xml/route.ts

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,24 @@ import { NextResponse } from 'next/server';
22
import { getAllPosts } from '@/lib/markdown';
33
import { 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

1724
export 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}`,

0 commit comments

Comments
 (0)