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