done landing page
This commit is contained in:
46
app/sitemap.xml/route.ts
Normal file
46
app/sitemap.xml/route.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
// app/sitemap/route.ts
|
||||
|
||||
interface SitemapPage {
|
||||
loc: string;
|
||||
lastmod: string;
|
||||
}
|
||||
|
||||
export const GET = async () => {
|
||||
const BASE_URL = "https://trees.falktron.com";
|
||||
|
||||
const useCases = [
|
||||
"forestry",
|
||||
"research",
|
||||
"agriculture",
|
||||
"cities-communities",
|
||||
];
|
||||
|
||||
const pages: SitemapPage[] = [
|
||||
{ loc: `${BASE_URL}/`, lastmod: new Date().toISOString().split("T")[0] },
|
||||
...useCases.map((slug) => ({
|
||||
loc: `${BASE_URL}/use-cases/${slug}`,
|
||||
lastmod: new Date().toISOString().split("T")[0],
|
||||
})),
|
||||
];
|
||||
|
||||
const xml = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
${pages
|
||||
.map(
|
||||
(page) => `
|
||||
<url>
|
||||
<loc>${page.loc}</loc>
|
||||
<lastmod>${page.lastmod}</lastmod>
|
||||
</url>`
|
||||
)
|
||||
.join("")}
|
||||
</urlset>`;
|
||||
|
||||
return new Response(xml, {
|
||||
status: 200,
|
||||
headers: {
|
||||
"Content-Type": "application/xml",
|
||||
"Cache-Control": "public, s-maxage=86400, stale-while-revalidate=3600",
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user