Skip to content

Commit 6ff7178

Browse files
authored
GRA-164: adds sitemap-index to website (#76)
1 parent 2213823 commit 6ff7178

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/app/robots.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function robots(): MetadataRoute.Robots {
88
disallow: [],
99
},
1010
sitemap: [
11-
'https://grapesjs.com/sitemap.xml',
11+
'https://grapesjs.com/sitemap-index.xml',
1212
'https://app.grapesjs.com/sitemap.xml',
1313
],
1414
};

src/app/sitemap-index.xml/route.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { NextResponse } from 'next/server';
2+
3+
const SITE_URL = 'https://grapesjs.com';
4+
5+
export async function GET() {
6+
const sitemapIndex = `<?xml version="1.0" encoding="UTF-8"?>
7+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
8+
<sitemap>
9+
<loc>${SITE_URL}/sitemap.xml</loc>
10+
<lastmod>${new Date().toISOString().split('T')[0]}</lastmod>
11+
</sitemap>
12+
<sitemap>
13+
<loc>${SITE_URL}/docs/sitemap.xml</loc>
14+
<lastmod>${new Date().toISOString().split('T')[0]}</lastmod>
15+
</sitemap>
16+
</sitemapindex>`;
17+
18+
return new NextResponse(sitemapIndex, {
19+
status: 200,
20+
headers: {
21+
'Content-Type': 'application/xml',
22+
},
23+
});
24+
}
25+

0 commit comments

Comments
 (0)