17 lines
494 B
TypeScript
17 lines
494 B
TypeScript
import type { ParsedContent } from '@nuxt/content/dist/runtime/types'
|
|
import { formatDate } from 'date-fns'
|
|
|
|
import { serverQueryContent } from '#content/server'
|
|
|
|
export default defineSitemapEventHandler(async (e) => {
|
|
const contentList = (await serverQueryContent(e).find()) as ParsedContent[]
|
|
return contentList.map((c) => {
|
|
return asSitemapUrl({
|
|
loc: c._path,
|
|
lastmod: formatDate(c.updated, 'yyyy-MM-dd'),
|
|
changefreq: 'monthly',
|
|
priority: 0.9,
|
|
})
|
|
})
|
|
})
|