Empty nuxt-content-urls.json
I am using nuxt/content together with nuxt/sitemap to generate a xml file with all routes. However the content routes are not included in the sitemap s I debugged the sitemap and found out that the endpoint to fetch the sitemap for the content directory is returning an empty array even tho I have content pages.
5 Replies
Hi @Blouflash. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To address your issue with nuxt/content and nuxt/sitemap where content routes are not included in the sitemap, there are a few potential solutions:
1. Ensure you're using the correct configuration for the sitemap module. According to the Nuxt Content documentation (https://content.nuxt.com/v1/community/integrations/#nuxtjssitemap), you should declare the sitemap module last in your
nuxt.config.js
file and provide a configuration object:
2. Implement a createSitemapRoutes
function to dynamically generate routes for your content:
3. If you're using Nuxt 3, you might need to use a different approach. As mentioned in a Stack Overflow post (https://stackoverflow.com/questions/78008815), you may need to add an API source for nuxt sitemap to generate the pages. For dynamic pages, refer to the NuxtSEO documentation on dynamic URLs (https://nuxtseo.com/sitemap/guides/dynamic-urls).
4. Another approach is to create a server route to generate the sitemap. The Nuxt Content documentation (https://content.nuxt.com/recipes/sitemap/#server-route) provides an example of how to do this:
5. If you're using nuxt generate
, you may need to pre-render the sitemap. Add this to your nuxt.config.ts
:
If these solutions don't resolve your issue, you may need to debug further to ensure that your content is being properly fetched and that there are no errors in your configuration or content structure.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@78895484986458112> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
I have this enabled:
and when debugging i also see that it tries to fetch from the integrated api from nux/content
it works in a production build