Capital/server/api/sitemap/posts.ts
LittleSheep ad5aacce9c 🔍 Sitemap!
 Dark mode to protect your eyes
2024-08-10 21:16:36 +08:00

12 lines
339 B
TypeScript

export default defineSitemapEventHandler(async () => {
const config = useRuntimeConfig();
const res = await fetch(`${config.public.solarNetworkApi}/cgi/interactive/posts?take=500`)
const result = await res.json()
return result.data.map((item: any) => asSitemapUrl({
loc: `/posts/${item.id}`,
_sitemap: "posts",
}));
})