How to add blog post to sitemap.xml with Nuxt Content v3 ?
for nuxt content v2 i was uded something like this in server/routes:
But with Nuxt Content v3 struggeling to make it working
import type { ParsedContent } from '@nuxt/content/dist/runtime/types'
import { serverQueryContent } from '#content/server'
import { asSitemapUrl, defineSitemapEventHandler } from '#imports'
export default defineSitemapEventHandler(async (e) => {
const contentList = (await serverQueryContent(e).find()) as ParsedContent[]
// console.log(contentList)
return contentList
.filter((c) => c._path.startsWith('/blog') || c._path.startsWith('/page'))
.map((c) => {
return asSitemapUrl({
loc: c._path,
// lastmod: updatedAt
})
})
})import type { ParsedContent } from '@nuxt/content/dist/runtime/types'
import { serverQueryContent } from '#content/server'
import { asSitemapUrl, defineSitemapEventHandler } from '#imports'
export default defineSitemapEventHandler(async (e) => {
const contentList = (await serverQueryContent(e).find()) as ParsedContent[]
// console.log(contentList)
return contentList
.filter((c) => c._path.startsWith('/blog') || c._path.startsWith('/page'))
.map((c) => {
return asSitemapUrl({
loc: c._path,
// lastmod: updatedAt
})
})
})But with Nuxt Content v3 struggeling to make it working
