NuxtN
Nuxt2y ago
nilssso

Empty @nuxtjs/sitemap with @nuxt/content document driven mode

I'm using @nuxt/content and @nuxtjs/sitemap with the following config
export default defineNuxtConfig({
  devtools: { enabled: true },
  modules: [
    '@nuxt/content',
    '@nuxt/ui',
    '@nuxtjs/sitemap',
  ],
  content: {
    documentDriven: true,
  },
})

And I have some content
content
├── contact.md
├── glossary.md
├── index.md
├── leadership.md
├── home-owners
│   └── faq.md
└── services
    ├── 1.special-districts.md
    ├── 2.fee-studies.md
    ├── 3.ongoing-reporting.md
    ├── 4.gis.md
    ├── 5.arbitrage-compliance.md
    ├── 6.prop-218-notification.md
    └── index.md

2 directories, 12 files

But when I hop over to http://localhost:3000/sitemap.xml I see absolutely nothing.

Going off of https://nuxtseo.com/sitemap/integrations/content#document-driven-mode it sounded like no configuration besdies documentDriven: true is necessary

When using documentDriven mode, all paths will be automatically added to the sitemap.

But under #markdown-opt-in it does say

If you want to add markdown pages to your sitemap without any extra config, you can use the sitemap key on your frontmatter. You must provide a loc value, or the page must have a path.

Does this pertain to document driven mode too? As in, even though I can go to http://localhost:3000/leadership, I still need to manually specify loc: /leadership in the markdown frontmatter?

---
title: Leadership
sitemap:
  loc: /leadership
---


And with that the page is included in the sitemap. But is this working as intended?
image.png
Was this page helpful?