"use server"; import { getListContent } from "@/service/landing/landing"; import { NextResponse } from "next/server"; export async function GET() { const baseUrl = "https://mediahub.polri.go.id/in"; const response = await getListContent({ page: 1, limit: "100", search: "" }); const articles = response?.data?.data || []; const urls = articles .map( (article: any) => ` ${baseUrl}/${article.fileTypeId == 1 ? "image" : article.fileTypeId == 2 ? "video" : article.fileTypeId == 3 ? "document" : "audio"}/detail/${article.id}-${article.slug} ${new Date(article.updatedAt).toISOString()} weekly 0.8 ` ) .join(""); const sitemap = ` ${baseUrl} ${new Date().toISOString()} daily 1.0 ${urls} `; return new NextResponse(sitemap, { headers: { "Content-Type": "application/xml", }, }); }