I am facing the same issue as described above. I'm not able to generate a sitemap that includes dynamic data from Prismic.
I am running:
"nuxt": "^2.0.0",
"@nuxtjs/sitemap": "^2.0.1",
"prismic-javascript": "^3.0.2",
Here are the contents of my files:
# nuxt.config.js
const Prismic = require("@prismicio/client")
buildModules: [
...,
['@nuxtjs/prismic', {
endpoint: 'https://my-prismic-website.cdn.prismic.io/api/v2',
modern: true,
apiOptions: {
routes: [
{
type: 'blog_article',
path: '/blog/prismic/:uid',
},
],
},
}],
...,
sitemap: {
hostname: process.env.NUXT_ENV_RC_HOSTNAME,
gzip: true,
}
...
generate: {
routes () {
const client = Prismic.client('my-prismic-website')
const pages = client.query(Prismic.Predicates.at('document.type', 'blog_article'))
.then(res => {
return res.results.map(page => {
return '/blog/prismic/' + page.uid
})
})
return pages
}
}
The app runs as expected but I get a weird error in my sitemap.xml page stating TypeError: Only absolute URLs are supported.
I have also tried defining the routes inside of the sitemap property like this:
sitemap: {
...,
routes: async () => {
const client = Prismic.client('my-prismic-website')
const pages = client.query(Prismic.Predicates.at('document.type', 'blog_article'))
.then(res => {
return res.results.map(page => {
return process.env.NUXT_ENV_RC_HOSTNAME + '/blog/' + page.uid
})
})
return pages
}
(I even tried both with and without the process.env.NUXT_ENV_RC_HOSTNAME
)
But I always get the exact same error TypeError: Only absolute URLs are supported.
Could you take a look and see what I could be missing?