File tree 3 files changed +17
-4
lines changed
3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,17 @@ export default defineContentConfig({
29
29
})
30
30
```
31
31
32
+ Due to current Nuxt Content v3 limitations, you must load the sitemap module before the content module.
33
+
34
+ ``` ts
35
+ export default defineNuxtConfig ({
36
+ modules: [
37
+ ' @nuxtjs/sitemap' ,
38
+ ' @nuxt/content' // <-- Must be after @nuxtjs/sitemap
39
+ ]
40
+ })
41
+ ```
42
+
32
43
33
44
## Setup Nuxt Content v2
34
45
Original file line number Diff line number Diff line change @@ -360,6 +360,10 @@ declare module 'vue-router' {
360
360
const nuxtV3Collections = new Set < string > ( )
361
361
const isNuxtContentV2 = usingNuxtContent && await hasNuxtModuleCompatibility ( '@nuxt/content' , '^2' )
362
362
if ( isNuxtContentV3 ) {
363
+ // check if content was loaded first
364
+ if ( nuxt . options . _installedModules . some ( m => m . meta . name === 'Content' ) ) {
365
+ logger . warn ( 'You have loaded `@nuxt/content` before `@nuxtjs/sitemap`, this may cause issues with the integration. Please ensure `@nuxtjs/sitemap` is loaded first.' )
366
+ }
363
367
// TODO this is a hack until content gives us an alias
364
368
nuxt . options . alias [ '#sitemap/content-v3-nitro-path' ] = resolve ( dirname ( resolveModule ( '@nuxt/content' ) ) , 'runtime/nitro' )
365
369
// @ts -expect-error runtime type
@@ -388,7 +392,6 @@ declare module 'vue-router' {
388
392
}
389
393
// Note: videos only supported through prerendering for simpler logic
390
394
391
- const sitemapConfig = typeof content . sitemap === 'object' ? content . sitemap : { }
392
395
const lastmod = content . seo ?. articleModifiedTime || content . updatedAt
393
396
const defaults : Partial < SitemapUrl > = {
394
397
loc : content . path ,
@@ -397,8 +400,7 @@ declare module 'vue-router' {
397
400
defaults . images = images
398
401
if ( lastmod )
399
402
defaults . lastmod = lastmod
400
- content . sitemap = defu ( sitemapConfig , defaults ) as Partial < SitemapUrl >
401
- ctx . content = content
403
+ ctx . content . sitemap = defu ( typeof content . sitemap === 'object' ? content . sitemap : { } , defaults ) as Partial < SitemapUrl >
402
404
} )
403
405
404
406
addServerHandler ( {
Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ import NuxtRobots from '../../../src/module'
2
2
3
3
export default defineNuxtConfig ( {
4
4
modules : [
5
- NuxtRobots ,
6
5
'@nuxt/content' ,
6
+ NuxtRobots ,
7
7
] ,
8
8
9
9
site : {
You can’t perform that action at this time.
0 commit comments