diff --git a/app/sitemap.xml/route.ts b/app/sitemap.xml/route.ts deleted file mode 100644 index fe72929..0000000 --- a/app/sitemap.xml/route.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { getListArticle } from "@/services/article"; -import { convertDateFormatNoTimeV2 } from "@/utils/global"; -import { NextResponse } from "next/server"; - -export async function GET() { - const baseUrl = "https://eppid.polri.go.id"; - - const request = { limit: "100", page: 0, search: "" }; - const response = await getListArticle(request); - - const articles = response?.data?.data || []; - - const urls = articles - .map( - (article: any) => ` - - ${baseUrl}/news/detail/${article.id} - ${convertDateFormatNoTimeV2( - new Date(article.updatedAt) - )} - weekly - 0.8 - ` - ) - .join(""); - - const sitemap = ` - - - ${baseUrl} - ${convertDateFormatNoTimeV2(new Date())} - daily - 1.0 - - ${urls} - `; - - return new NextResponse(sitemap, { - headers: { - "Content-Type": "application/xml", - }, - }); -}