2024-08-10 21:16:36 +08:00
|
|
|
export default defineSitemapEventHandler(async () => {
|
|
|
|
const config = useRuntimeConfig();
|
|
|
|
|
2024-08-17 23:56:03 +08:00
|
|
|
const res = await fetch(`${config.public.solarNetworkApi}/cgi/co/posts/minimal?take=500`)
|
2024-08-10 21:16:36 +08:00
|
|
|
const result = await res.json()
|
|
|
|
|
|
|
|
return result.data.map((item: any) => asSitemapUrl({
|
2024-08-17 22:38:13 +08:00
|
|
|
loc: item.alias ? `/posts/${item.area_alias}/${item.alias}` : `/posts/${item.id}`,
|
2024-08-16 16:53:23 +08:00
|
|
|
lastmod: item.edited_at ?? item.published_at,
|
2024-08-17 10:32:24 +08:00
|
|
|
priority: 0.7,
|
2024-08-10 21:16:36 +08:00
|
|
|
_sitemap: "posts",
|
|
|
|
}));
|
|
|
|
})
|