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",
},
});
}