@nuxtjs/sitemap 2.3.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +60 -569
  2. package/dist/client/200.html +11 -0
  3. package/dist/client/404.html +11 -0
  4. package/dist/client/_nuxt/Icon.I3NdYkjC.css +1 -0
  5. package/dist/client/_nuxt/Icon.wdYGFqbO.js +1 -0
  6. package/dist/client/_nuxt/IconCSS.6oz918NR.css +1 -0
  7. package/dist/client/_nuxt/IconCSS.L-uj6Ouj.js +1 -0
  8. package/dist/client/_nuxt/builds/latest.json +1 -0
  9. package/dist/client/_nuxt/builds/meta/c3bdccb2-d4db-4a94-9e61-39b740a57bf8.json +1 -0
  10. package/dist/client/_nuxt/entry.Soe9IWze.js +15 -0
  11. package/dist/client/_nuxt/entry.UqhvG0ao.css +1 -0
  12. package/dist/client/_nuxt/error-404.DkXpI38i.css +1 -0
  13. package/dist/client/_nuxt/error-404.uz-DxZsp.js +1 -0
  14. package/dist/client/_nuxt/error-500.BsNDeZpL.js +1 -0
  15. package/dist/client/_nuxt/error-500.SLhS9LVu.css +1 -0
  16. package/dist/client/_nuxt/index.lSDm5iYo.js +1 -0
  17. package/dist/client/index.html +11 -0
  18. package/dist/module.cjs +5 -0
  19. package/dist/module.d.mts +350 -0
  20. package/dist/module.d.ts +350 -0
  21. package/dist/module.json +9 -0
  22. package/dist/module.mjs +994 -0
  23. package/dist/runtime/nitro/composables/asSitemapUrl.d.ts +2 -0
  24. package/dist/runtime/nitro/composables/asSitemapUrl.mjs +3 -0
  25. package/dist/runtime/nitro/composables/defineSitemapEventHandler.d.ts +3 -0
  26. package/dist/runtime/nitro/composables/defineSitemapEventHandler.mjs +2 -0
  27. package/dist/runtime/nitro/composables/getPathRobotConfigPolyfill.d.ts +4 -0
  28. package/dist/runtime/nitro/composables/getPathRobotConfigPolyfill.mjs +3 -0
  29. package/dist/runtime/nitro/kit.d.ts +3 -0
  30. package/dist/runtime/nitro/kit.mjs +23 -0
  31. package/dist/runtime/nitro/middleware/[sitemap]-sitemap.xml.d.ts +2 -0
  32. package/dist/runtime/nitro/middleware/[sitemap]-sitemap.xml.mjs +23 -0
  33. package/dist/runtime/nitro/plugins/compression.d.ts +2 -0
  34. package/dist/runtime/nitro/plugins/compression.mjs +8 -0
  35. package/dist/runtime/nitro/plugins/nuxt-content.d.ts +2 -0
  36. package/dist/runtime/nitro/plugins/nuxt-content.mjs +38 -0
  37. package/dist/runtime/nitro/plugins/warm-up.d.ts +2 -0
  38. package/dist/runtime/nitro/plugins/warm-up.mjs +23 -0
  39. package/dist/runtime/nitro/routes/__sitemap__/debug.d.ts +37 -0
  40. package/dist/runtime/nitro/routes/__sitemap__/debug.mjs +29 -0
  41. package/dist/runtime/nitro/routes/__sitemap__/nuxt-content-urls.d.ts +2 -0
  42. package/dist/runtime/nitro/routes/__sitemap__/nuxt-content-urls.mjs +6 -0
  43. package/dist/runtime/nitro/routes/sitemap.xml.d.ts +2 -0
  44. package/dist/runtime/nitro/routes/sitemap.xml.mjs +13 -0
  45. package/dist/runtime/nitro/routes/sitemap.xsl.d.ts +2 -0
  46. package/dist/runtime/nitro/routes/sitemap.xsl.mjs +230 -0
  47. package/dist/runtime/nitro/routes/sitemap_index.xml.d.ts +2 -0
  48. package/dist/runtime/nitro/routes/sitemap_index.xml.mjs +27 -0
  49. package/dist/runtime/nitro/sitemap/builder/sitemap-index.d.ts +2 -0
  50. package/dist/runtime/nitro/sitemap/builder/sitemap-index.mjs +86 -0
  51. package/dist/runtime/nitro/sitemap/builder/sitemap.d.ts +2 -0
  52. package/dist/runtime/nitro/sitemap/builder/sitemap.mjs +107 -0
  53. package/dist/runtime/nitro/sitemap/builder/xml.d.ts +4 -0
  54. package/dist/runtime/nitro/sitemap/builder/xml.mjs +83 -0
  55. package/dist/runtime/nitro/sitemap/nitro.d.ts +4 -0
  56. package/dist/runtime/nitro/sitemap/nitro.mjs +36 -0
  57. package/dist/runtime/nitro/sitemap/urlset/filter.d.ts +5 -0
  58. package/dist/runtime/nitro/sitemap/urlset/filter.mjs +50 -0
  59. package/dist/runtime/nitro/sitemap/urlset/i18n.d.ts +8 -0
  60. package/dist/runtime/nitro/sitemap/urlset/i18n.mjs +128 -0
  61. package/dist/runtime/nitro/sitemap/urlset/normalise.d.ts +3 -0
  62. package/dist/runtime/nitro/sitemap/urlset/normalise.mjs +77 -0
  63. package/dist/runtime/nitro/sitemap/urlset/sort.d.ts +2 -0
  64. package/dist/runtime/nitro/sitemap/urlset/sort.mjs +19 -0
  65. package/dist/runtime/nitro/sitemap/urlset/sources.d.ts +5 -0
  66. package/dist/runtime/nitro/sitemap/urlset/sources.mjs +82 -0
  67. package/dist/runtime/nitro/tsconfig.json +3 -0
  68. package/dist/runtime/nitro/utils.d.ts +4 -0
  69. package/dist/runtime/nitro/utils.mjs +13 -0
  70. package/dist/runtime/types.d.ts +355 -0
  71. package/dist/runtime/types.mjs +0 -0
  72. package/dist/runtime/utils-pure.d.ts +7 -0
  73. package/dist/runtime/utils-pure.mjs +32 -0
  74. package/dist/types.d.mts +18 -0
  75. package/dist/types.d.ts +18 -0
  76. package/package.json +79 -75
  77. package/CHANGELOG.md +0 -256
  78. package/LICENSE +0 -21
  79. package/lib/builder.js +0 -174
  80. package/lib/cache.js +0 -95
  81. package/lib/generator.js +0 -113
  82. package/lib/logger.js +0 -19
  83. package/lib/middleware.js +0 -195
  84. package/lib/module.js +0 -70
  85. package/lib/options.js +0 -136
  86. package/lib/routes.js +0 -55
package/README.md CHANGED
@@ -1,590 +1,81 @@
1
- # Sitemap Module
2
-
3
- [![npm (scoped with tag)](https://img.shields.io/npm/v/@nuxtjs/sitemap/latest?style=flat-square)](https://npmjs.com/package/@nuxtjs/sitemap)
4
- [![Downloads](https://img.shields.io/npm/dw/@nuxtjs/sitemap?style=flat-square)](https://npmjs.com/package/@nuxtjs/sitemap)
5
- [![Build Status](https://img.shields.io/circleci/project/github/nuxt-community/sitemap-module?style=flat-square)](https://app.circleci.com/pipelines/github/nuxt-community/sitemap-module)
6
- [![Coverage Status](https://img.shields.io/codecov/c/github/nuxt-community/sitemap-module?style=flat-square)](https://codecov.io/gh/nuxt-community/sitemap-module)
7
- [![License](https://img.shields.io/npm/l/@nuxtjs/sitemap?style=flat-square)](http://standardjs.com)
8
-
9
- > Automatically generate or serve dynamic [sitemap.xml](https://www.sitemaps.org/protocol.html) for Nuxt.js projects!
10
-
11
- [📖 **Release Notes**](./CHANGELOG.md)
1
+ <h1 align='center'>@nuxtjs/sitemap</h1>
2
+
3
+ <p align="center">
4
+ <a href='https://github.com/nuxt-modules/sitemap/actions/workflows/test.yml'>
5
+ </a>
6
+ <a href="https://www.npmjs.com/package/@nuxtjs/sitemap" target="__blank"><img src="https://img.shields.io/npm/v/@nuxtjs/sitemap?style=flat&colorA=002438&colorB=28CF8D" alt="NPM version"></a>
7
+ <a href="https://www.npmjs.com/package/@nuxtjs/sitemap" target="__blank"><img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@nuxtjs/sitemap?flat&colorA=002438&colorB=28CF8D"></a>
8
+ <a href="https://github.com/nuxt-modules/sitemap" target="__blank"><img alt="GitHub stars" src="https://img.shields.io/github/stars/nuxt-modules/sitemap?flat&colorA=002438&colorB=28CF8D"></a>
9
+ </p>
10
+
11
+ <p align="center">
12
+ Powerfully flexible XML Sitemaps that integrate seamlessly, for Nuxt. Previously <i>nuxt-simple-sitemap</i>.
13
+ </p>
14
+
15
+ <p align="center">
16
+ <table>
17
+ <tbody>
18
+ <td align="center">
19
+ <img width="800" height="0" /><br>
20
+ <i>Status:</i> <a href="https://github.com/nuxt-modules/sitemap/releases/tag/v5.0.0">v5 Released 🎉</a></b> <br>
21
+ <sup> Please report any issues 🐛</sup><br>
22
+ <sub>Made possible by my <a href="https://github.com/sponsors/harlan-zw">Sponsor Program 💖</a><br> Follow me <a href="https://twitter.com/harlan_zw">@harlan_zw</a> 🐦 • Join <a href="https://discord.gg/275MBUBvgP">Discord</a> for help</sub><br>
23
+ <img width="800" height="0" />
24
+ </td>
25
+ </tbody>
26
+ </table>
27
+ </p>
12
28
 
13
29
  ## Features
14
30
 
15
- - Module based on the awesome **[sitemap.js](https://github.com/ekalinin/sitemap.js) package** ❤️
16
- - Create **sitemap** or **sitemap index**
17
- - Automatically add the static routes to each sitemap
18
- - Support **i18n** routes from **nuxt-i18n** (latest version)
19
- - Works with **all modes** (SSR, SPA, generate)
20
- - For **Nuxt 2.x** and higher
21
-
22
- ---
23
-
24
- ## Table of Contents
25
-
26
- - [Install](#installation)
27
- - [Setup](#setup)
28
- - [Usage](#usage)
29
- - [Sitemap Options](#sitemap-options)
30
- - [Sitemap Index Options](#sitemap-index-options)
31
- - [Routes Declaration](#routes-declaration)
31
+ - 🌴 Single `/sitemap.xml` or multiple `/posts-sitemap.xml`, `/pages-sitemap.xml`
32
+ - 📊 Fetch your sitemap URLs from anywhere
33
+ - 😌 Automatic `lastmod`, image discovery and best practice sitemaps
34
+ - 🔄 SWR caching, route rules support
35
+ - 🎨 Debug using the Nuxt DevTools integration or the XML Stylesheet
36
+ - 🤝 Integrates seamlessly with [Nuxt I18n](https://github.com/nuxt-modules/i18n) and [Nuxt Content](https://github.com/nuxt/content)
32
37
 
33
38
  ## Installation
34
39
 
35
- ```shell
36
- npm install @nuxtjs/sitemap
37
- ```
38
-
39
- or
40
-
41
- ```shell
42
- yarn add @nuxtjs/sitemap
43
- ```
44
-
45
- ## Setup
46
-
47
- Add `@nuxtjs/sitemap` to the `modules` section of your `nuxt.config.js` file:
48
-
49
- ```js
50
- {
51
- modules: [
52
- '@nuxtjs/sitemap'
53
- ],
54
- }
55
- ```
56
-
57
- > **notice:**
58
- > If you use other modules (eg. `nuxt-i18n`), always declare the sitemap module at end of array
59
- > eg. `modules: ['nuxt-i18n', '@nuxtjs/sitemap']`
60
-
61
- ### Configuration
62
-
63
- Add a custom configuration with the `sitemap` property:
64
-
65
- ```js
66
- // nuxt.config.js
67
-
68
- {
69
- modules: [
70
- '@nuxtjs/sitemap'
71
- ],
72
- sitemap: {
73
- // options
74
- },
75
- }
76
- ```
77
-
78
- The module option parameter can be:
79
-
80
- ### `Object`
81
-
82
- A single item of [sitemap](#sitemap-options) or [sitemap index](#sitemap-index-options):
83
-
84
- ```js
85
- {
86
- sitemap: {
87
- // ...
88
- },
89
- }
90
- ```
91
-
92
- ### `Array`
93
-
94
- A list of [sitemap](#sitemap-options) or [sitemap index](#sitemap-index-options) items:
95
-
96
- ```js
97
- {
98
- sitemap: [
99
- {
100
- // ...
101
- },
102
- {
103
- // ...
104
- },
105
- ],
106
- }
107
- ```
108
-
109
- ### `Function`
110
-
111
- A function that returns a valid sitemap configuration:
112
-
113
- ```js
114
- {
115
- sitemap: function () {
116
- return {
117
- // ...
118
- }
119
- },
120
- }
121
- ```
122
-
123
- ### `Boolean`
124
-
125
- You can disable the sitemap module with a boolean value at `false`:
126
-
127
- ```js
128
- {
129
- sitemap: false
130
- }
131
- ```
132
-
133
- ## Usage
134
-
135
- ### Setup a Sitemap
136
-
137
- By default, the sitemap is setup to the following path: `/sitemap.xml`
138
- All static routes (eg. `/pages/about.vue`) are automatically add to the sitemap, but you can exclude each of them with the [`exclude`](#exclude-optional---string-array) property.
139
- For dynamic routes (eg. `/pages/_id.vue`), you have to declare them with the [`routes`](#routes-optional---array--function) property. This option can be an array or a function. In addition, the routes defined in `generate.routes` will be automatically used for the sitemap.
140
-
141
- ```js
142
- // nuxt.config.js
143
-
144
- {
145
- sitemap: {
146
- hostname: 'https://example.com',
147
- gzip: true,
148
- exclude: [
149
- '/secret',
150
- '/admin/**'
151
- ],
152
- routes: [
153
- '/page/1',
154
- '/page/2',
155
- {
156
- url: '/page/3',
157
- changefreq: 'daily',
158
- priority: 1,
159
- lastmod: '2017-06-30T13:30:00.000Z'
160
- }
161
- ]
162
- }
163
- }
164
- ```
165
-
166
- ### Setup a Sitemap Index
167
-
168
- To declare a sitemap index and its linked sitemaps, use the [`sitemaps`](#sitemaps---array-of-object) property.
169
- By default, the sitemap index is setup to the following path: `/sitemapindex.xml`
170
- Each item of the `sitemaps` array can be setup with its own [sitemap options](#sitemap-options).
171
-
172
- ```js
173
- // nuxt.config.js
174
-
175
- {
176
- sitemap: {
177
- hostname: 'https://example.com',
178
- lastmod: '2017-06-30',
179
- sitemaps: [
180
- {
181
- path: '/sitemap-foo.xml',
182
- routes: ['foo/1', 'foo/2'],
183
- gzip: true
184
- }, {
185
- path: '/folder/sitemap-bar.xml',
186
- routes: ['bar/1', 'bar/2'],
187
- exclude: ['/**']
188
- }
189
- ]
190
- }
191
- }
192
- ```
193
-
194
- ### Setup a list of sitemaps
195
-
196
- To declare a list of sitemaps, use an `array` to setup each sitemap with its own configuration.
197
- You can combine sitemap and sitemap index configurations.
198
-
199
- ```js
200
- // nuxt.config.js
201
-
202
- {
203
- sitemap: [
204
- {
205
- path: '/sitemap-products.xml',
206
- routes: [
207
- // array of URL
208
- ]
209
- }, {
210
- path: '/sitemap-news.xml',
211
- routes: () => // promise or function
212
- }, {
213
- path: '/sitemapindex.xml',
214
- sitemaps: [{
215
- // array of Sitemap configuration
216
- }]
217
- }
218
- }
219
- }
220
- ```
221
-
222
- ## Sitemap Options
223
-
224
- ### `routes` (optional) - array | function
225
-
226
- - Default: `[]` or [`generate.routes`](https://nuxtjs.org/api/configuration-generate#routes) value from your `nuxt.config.js`
227
-
228
- The `routes` parameter follows the same way than the `generate` [configuration](https://nuxtjs.org/api/configuration-generate#routes).
229
-
230
- See as well the [routes declaration](#routes-declaration) examples below.
231
-
232
- ### `path` (optional) - string
233
-
234
- - Default: `/sitemap.xml`
235
-
236
- The URL path of the generated sitemap.
237
-
238
- ### `hostname` (optional) - string
239
-
240
- - Default:
241
- 1. `sitemap.hostname` value from your `nuxt.config.js`
242
- 2. [`build.publicPath`](https://nuxtjs.org/api/configuration-build/#publicpath) value from your `nuxt.config.js` (⚠️ **deprecated**)
243
- 3. [`os.hostname()`](https://nodejs.org/api/os.html#os_os_hostname) in **generate** or **spa** mode, or dynamically based on request URL (`headers.host`) in **ssr** mode
244
-
245
- This value is **mandatory** for generation sitemap file, and you should explicitly provide it in **generate** or **spa** mode.
246
-
247
- ⚠️ The usage of `build.publicPath` as default value is deprecated and will be removed on release v3.0.
248
- To disable it on the current release, set a falsy value (eg. `hostname: false`).
249
-
250
- ### `cacheTime` (optional) - number
251
-
252
- - Default: `1000 * 60 * 15` (15 Minutes)
253
-
254
- Defines how frequently sitemap **routes** should be updated (value in milliseconds).
255
- Setting a negative value will disable the cache.
256
-
257
- Please note that after each invalidation, `routes` will be evaluated again (see [routes declaration](#routes-declaration) section).
258
-
259
- This option is only available in **ssr** mode.
260
-
261
- ### `etag` (optional) - object
262
-
263
- - Default: [`render.etag`](https://nuxtjs.org/api/configuration-render#etag) value from your `nuxt.config.js`
264
-
265
- Enable the etag cache header on sitemap (see [etag](https://nuxtjs.org/api/configuration-render#etag) docs for possible options).
266
-
267
- To disable etag for sitemap set `etag: false`
268
-
269
- This option is only available in **ssr** mode.
270
-
271
- ### `exclude` (optional) - string array
272
-
273
- - Default: `[]`
274
-
275
- The `exclude` parameter is an array of [glob patterns](https://github.com/isaacs/minimatch#features) to exclude static routes from the generated sitemap.
276
-
277
- ### `filter` (optional) - function
278
-
279
- - Default: `undefined`
280
-
281
- If the `filter` option is set as a function, all routes will be filtered through it.
282
-
283
- This option is useful to customize or extend the features of the module, before the sitemap generation.
284
-
285
- Examples:
40
+ 💡 Need a more complete SEO solution for Nuxt? This module is included as part of [Nuxt SEO](https://nuxtseo.com).
286
41
 
287
- ```js
288
- // nuxt.config.js
42
+ 1. Install `@nuxtjs/sitemap` dependency to your project:
289
43
 
290
- // Filter routes by language
291
- {
292
- sitemap: {
293
- filter ({ routes, options }) {
294
- if (options.hostname === 'example.com') {
295
- return routes.filter(route => route.locale === 'en')
296
- }
297
- return routes.filter(route => route.locale === 'fr')
298
- }
299
- }
300
- }
301
-
302
- // Add a trailing slash to each route
303
- {
304
- sitemap: {
305
- filter ({ routes }) {
306
- return routes.map(route => {
307
- route.url = `${route.url}/`
308
- return route
309
- })
310
- }
311
- }
312
- }
313
- ```
314
-
315
- ### `gzip` (optional) - boolean
316
-
317
- - Default: `false`
318
-
319
- Enable the creation of the `.xml.gz` sitemap compressed with gzip.
320
-
321
- ### `xmlNs` (optional) - string
322
-
323
- - Default: `undefined`
324
-
325
- Set the XML namespaces by override all default `xmlns` attributes in `<urlset>` element.
326
-
327
- ```js
328
- // nuxt.config.js
329
-
330
- {
331
- sitemap: {
332
- xmlNs: 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"'
333
- }
334
- }
335
- ```
336
-
337
- ### `xslUrl` (optional) - string
338
-
339
- - Default: `undefined`
340
-
341
- The URL path of the XSL file to style the sitemap.
342
-
343
- ### `trailingSlash` (optional) - boolean
344
-
345
- - Default: `false`
346
-
347
- Add a trailing slash to each route URL (eg. `/page/1` => `/page/1/`)
348
-
349
- > **notice:** To avoid [duplicate content](https://support.google.com/webmasters/answer/66359) detection from crawlers, you have to configure an HTTP 301 redirect between the 2 URLs (see [redirect-module](https://github.com/nuxt-community/redirect-module) or [nuxt-trailingslash-module](https://github.com/WilliamDASILVA/nuxt-trailingslash-module)).
350
-
351
- ### `i18n` (optional) - string | object
352
-
353
- - Default: `undefined`
354
-
355
- Configure the support of localized routes from **[nuxt-i18n](https://www.npmjs.com/package/nuxt-i18n)** module.
356
-
357
- If the `i18n` option is configured, the sitemap module will automatically add the default locale URL of each page in a `<loc>` element, with child `<xhtml:link>` entries listing every language/locale variant of the page including itself (see [Google sitemap guidelines](https://support.google.com/webmasters/answer/189077)).
358
-
359
- Example:
360
-
361
- ```js
362
- // nuxt.config.js
363
-
364
- {
365
- modules: [
366
- 'nuxt-i18n',
367
- '@nuxtjs/sitemap'
368
- ],
369
- i18n: {
370
- locales: ['en', 'es', 'fr'],
371
- defaultLocale: 'en'
372
- },
373
- sitemap: {
374
- hostname: 'https://example.com',
375
- // shortcut notation (basic)
376
- i18n: 'en',
377
- // nuxt-i18n notation (advanced)
378
- i18n: {
379
- defaultLocale: 'en',
380
- locales: ['en', 'es', 'fr'],
381
- routesNameSeparator: '___'
382
- }
383
- }
384
- }
385
- ```
386
-
387
- ```xml
388
- <url>
389
- <loc>https://example.com/</loc>
390
- <xhtml:link rel="alternate" hreflang="en" href="https://example.com/"/>
391
- <xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/"/>
392
- <xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/"/>
393
- </url>
44
+ ```bash
45
+ pnpm add -D @nuxtjs/sitemap
46
+ #
47
+ yarn add -D @nuxtjs/sitemap
48
+ #
49
+ npm install -D @nuxtjs/sitemap
394
50
  ```
395
51
 
396
- ### `defaults` (optional) - object
52
+ 2. Add it to your `modules` section in your `nuxt.config`:
397
53
 
398
- - Default: `{}`
399
-
400
- The `defaults` parameter set the default options for all routes.
401
-
402
- ```js
403
- // nuxt.config.js
404
-
405
- {
406
- sitemap: {
407
- defaults: {
408
- changefreq: 'daily',
409
- priority: 1,
410
- lastmod: new Date()
411
- }
412
- }
413
- }
54
+ ```ts
55
+ export default defineNuxtConfig({
56
+ modules: ['@nuxtjs/sitemap']
57
+ })
414
58
  ```
415
59
 
416
- See available options: https://github.com/ekalinin/sitemap.js/blob/4.1.1/README.md#sitemap-item-options
417
-
418
- ## Sitemap Index Options
419
-
420
- ### `path` (optional) - string
60
+ # Documentation
421
61
 
422
- - Default: `/sitemapindex.xml`
62
+ [📖 Read the full documentation](https://nuxtseo.com/sitemap) for more information.
423
63
 
424
- The URL path of the generated sitemap index.
64
+ ### StackBlitz Demos / Reproductions
425
65
 
426
- ### `hostname` (optional) - string
427
-
428
- Set the `hostname` value to each sitemap linked to its sitemap index.
429
-
430
- ### `sitemaps` - array of object
431
-
432
- - Default: `[]`
433
-
434
- Array of [sitemap configuration](#sitemap-options]) linked to the sitemap index.
435
-
436
- ```js
437
- // nuxt.config.js
438
-
439
- {
440
- sitemap: {
441
- path: '/sitemapindex.xml',
442
- hostname: 'https://example.com',
443
- sitemaps: [
444
- {
445
- path: '/sitemap-foo.xml',
446
- // ...
447
- }, {
448
- path: '/folder/sitemap-bar.xml',
449
- // ...
450
- }
451
- ]
452
- }
453
- }
454
- ```
455
-
456
- ```xml
457
- <!-- generated sitemapindex.xml -->
458
-
459
- <?xml version="1.0" encoding="UTF-8"?>
460
- <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
461
- <sitemap>
462
- <loc>https://example.com/sitemap-foo.xml</loc>
463
- </sitemap>
464
- <sitemap>
465
- <loc>https://example.com/folder/sitemap-bar.xml</loc>
466
- </sitemap>
467
- </sitemapindex>
468
- ```
66
+ - [Dynamic URLs](https://stackblitz.com/edit/nuxt-starter-dyraxc?file=server%2Fapi%2F_sitemap-urls.ts)
67
+ - [i18n](https://stackblitz.com/edit/nuxt-starter-jwuie4?file=app.vue)
68
+ - [Manual Chunking](https://stackblitz.com/edit/nuxt-starter-umyso3?file=nuxt.config.ts)
69
+ - [Nuxt Content Document Driven](https://stackblitz.com/edit/nuxt-starter-a5qk3s?file=nuxt.config.ts)
469
70
 
470
- See more [examples](#usage) above.
71
+ ## Sponsors
471
72
 
472
- ### `lastmod` (optional) - string
473
-
474
- Set the `lastmod` value to each sitemap linked to its sitemap index.
475
-
476
- In addition, the `lastmod` can be defined for each linked sitemap.
477
-
478
- ```js
479
- // nuxt.config.js
480
-
481
- {
482
- sitemap: {
483
- lastmod: "2020-01-01",
484
- sitemaps: [
485
- {
486
- path: '/sitemap-foo.xml',
487
- lastmod: "2020-01-02"
488
- }, {
489
- path: '/sitemap-bar.xml'
490
- }
491
- ]
492
- }
493
- }
494
- ```
495
-
496
- ### `etag` (optional) - object
497
-
498
- - Default: [`render.etag`](https://nuxtjs.org/api/configuration-render#etag) value from your `nuxt.config.js`
499
-
500
- Enable the etag cache header on sitemap index (See [etag](https://nuxtjs.org/api/configuration-render#etag) docs for possible options).
501
-
502
- To disable etag for sitemap index set `etag: false`
503
-
504
- This option is only available in **ssr** mode.
505
-
506
- ### `gzip` (optional) - boolean
507
-
508
- - Default: `false`
509
-
510
- Enable the creation of the `.xml.gz` sitemap index compressed with gzip.
511
-
512
- ### `xmlNs` (optional) - string
513
-
514
- - Default: `undefined`
515
-
516
- Set the XML namespaces by override all default `xmlns` attributes in `<sitemapindex>` element.
517
-
518
- ```js
519
- // nuxt.config.js
520
-
521
- {
522
- sitemap: {
523
- xmlNs: 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"',
524
- sitemaps: [...]
525
- }
526
- }
527
- ```
528
-
529
- ### `xslUrl` (optional) - string
530
-
531
- - Default: `undefined`
532
-
533
- The URL path of the XSL file to style the sitemap index.
534
-
535
- ## Routes Declaration
536
-
537
- By default, the dynamic routes are ignored by the sitemap module.
538
- Nuxt cannot automatically provide this type of complex routes.
539
-
540
- Example:
541
-
542
- ```
543
- -| pages/
544
- ---| index.vue --> static route
545
- ---| about.vue --> static route
546
- ---| users/
547
- -----| _id.vue --> dynamic route
548
- ```
549
-
550
- If you want the module to add any route with dynamic parameters, you have to set an array of dynamic routes.
551
-
552
- eg. add routes for `/users/:id` in the configuration:
553
-
554
- ### From a static list
555
-
556
- ```js
557
- // nuxt.config.js
558
-
559
- {
560
- sitemap: {
561
- routes: ['/users/1', '/users/2', '/users/3']
562
- }
563
- }
564
- ```
565
-
566
- ### From a function which returns a Promise
567
-
568
- ```js
569
- // nuxt.config.js
570
-
571
- const axios = require('axios')
572
-
573
- {
574
- sitemap: {
575
- routes: async () => {
576
- const { data } = await axios.get('https://jsonplaceholder.typicode.com/users')
577
- return data.map((user) => `/users/${user.username}`)
578
- }
579
- }
580
- }
581
- ```
73
+ <p align="center">
74
+ <a href="https://raw.githubusercontent.com/harlan-zw/static/main/sponsors.svg">
75
+ <img src='https://raw.githubusercontent.com/harlan-zw/static/main/sponsors.svg'/>
76
+ </a>
77
+ </p>
582
78
 
583
79
  ## License
584
80
 
585
- [MIT License](./LICENSE)
586
-
587
- ## Contributors
588
-
589
- - [Nicolas Pennec](https://github.com/NicoPennec)
590
- - [Pooya Parsa](https://github.com/pi0)
81
+ MIT License © 2022-PRESENT [Harlan Wilton](https://github.com/harlan-zw)
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html><html><head><meta charset="utf-8">
2
+ <meta name="viewport" content="width=device-width, initial-scale=1">
3
+ <link rel="stylesheet" href="/__sitemap__/devtools/_nuxt/entry.UqhvG0ao.css">
4
+ <link rel="modulepreload" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/entry.Soe9IWze.js">
5
+ <link rel="prefetch" as="style" href="/__sitemap__/devtools/_nuxt/error-404.DkXpI38i.css">
6
+ <link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/error-404.uz-DxZsp.js">
7
+ <link rel="prefetch" as="style" href="/__sitemap__/devtools/_nuxt/error-500.SLhS9LVu.css">
8
+ <link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/error-500.BsNDeZpL.js">
9
+ <script type="module" src="/__sitemap__/devtools/_nuxt/entry.Soe9IWze.js" crossorigin></script><script>"use strict";(()=>{const a=window,e=document.documentElement,m=["dark","light"],c=window&&window.localStorage&&window.localStorage.getItem&&window.localStorage.getItem("nuxt-color-mode")||"system";let n=c==="system"?d():c;const l=e.getAttribute("data-color-mode-forced");l&&(n=l),i(n),a["__NUXT_COLOR_MODE__"]={preference:c,value:n,getColorScheme:d,addColorScheme:i,removeColorScheme:f};function i(o){const t=""+o+"",s="";e.classList?e.classList.add(t):e.className+=" "+t,s&&e.setAttribute("data-"+s,o)}function f(o){const t=""+o+"",s="";e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp(t,"g"),""),s&&e.removeAttribute("data-"+s)}function r(o){return a.matchMedia("(prefers-color-scheme"+o+")")}function d(){if(a.matchMedia&&r("").media!=="not all"){for(const o of m)if(r(":"+o).matches)return o}return"light"}})();
10
+ </script></head><body><div id="__nuxt"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"_errors":1,"serverRendered":2,"data":3,"state":4,"once":5},{},false,{},{},["Set"]]</script>
11
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__sitemap__/devtools",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html><html><head><meta charset="utf-8">
2
+ <meta name="viewport" content="width=device-width, initial-scale=1">
3
+ <link rel="stylesheet" href="/__sitemap__/devtools/_nuxt/entry.UqhvG0ao.css">
4
+ <link rel="modulepreload" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/entry.Soe9IWze.js">
5
+ <link rel="prefetch" as="style" href="/__sitemap__/devtools/_nuxt/error-404.DkXpI38i.css">
6
+ <link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/error-404.uz-DxZsp.js">
7
+ <link rel="prefetch" as="style" href="/__sitemap__/devtools/_nuxt/error-500.SLhS9LVu.css">
8
+ <link rel="prefetch" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/error-500.BsNDeZpL.js">
9
+ <script type="module" src="/__sitemap__/devtools/_nuxt/entry.Soe9IWze.js" crossorigin></script><script>"use strict";(()=>{const a=window,e=document.documentElement,m=["dark","light"],c=window&&window.localStorage&&window.localStorage.getItem&&window.localStorage.getItem("nuxt-color-mode")||"system";let n=c==="system"?d():c;const l=e.getAttribute("data-color-mode-forced");l&&(n=l),i(n),a["__NUXT_COLOR_MODE__"]={preference:c,value:n,getColorScheme:d,addColorScheme:i,removeColorScheme:f};function i(o){const t=""+o+"",s="";e.classList?e.classList.add(t):e.className+=" "+t,s&&e.setAttribute("data-"+s,o)}function f(o){const t=""+o+"",s="";e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp(t,"g"),""),s&&e.removeAttribute("data-"+s)}function r(o){return a.matchMedia("(prefers-color-scheme"+o+")")}function d(){if(a.matchMedia&&r("").media!=="not all"){for(const o of m)if(r(":"+o).matches)return o}return"light"}})();
10
+ </script></head><body><div id="__nuxt"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"_errors":1,"serverRendered":2,"data":3,"state":4,"once":5},{},false,{},{},["Set"]]</script>
11
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__sitemap__/devtools",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -0,0 +1 @@
1
+ .icon[data-v-1e7c9185]{display:inline-block;vertical-align:middle}