@nuxtjs/sitemap 2.4.0 → 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 -593
  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 -268
  78. package/LICENSE +0 -21
  79. package/lib/builder.js +0 -172
  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 -72
  85. package/lib/options.js +0 -135
  86. package/lib/routes.js +0 -55
package/README.md CHANGED
@@ -1,614 +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)
32
- - [Hooks](#hooks)
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)
33
37
 
34
38
  ## Installation
35
39
 
36
- ```shell
37
- npm install @nuxtjs/sitemap
38
- ```
39
-
40
- or
41
-
42
- ```shell
43
- yarn add @nuxtjs/sitemap
44
- ```
45
-
46
- ## Setup
47
-
48
- Add `@nuxtjs/sitemap` to the `modules` section of your `nuxt.config.js` file:
49
-
50
- ```js
51
- {
52
- modules: [
53
- '@nuxtjs/sitemap'
54
- ],
55
- }
56
- ```
57
-
58
- > **notice:**
59
- > If you use other modules (eg. `nuxt-i18n`), always declare the sitemap module at end of array
60
- > eg. `modules: ['nuxt-i18n', '@nuxtjs/sitemap']`
61
-
62
- ### Configuration
63
-
64
- Add a custom configuration with the `sitemap` property:
65
-
66
- ```js
67
- // nuxt.config.js
68
-
69
- {
70
- modules: [
71
- '@nuxtjs/sitemap'
72
- ],
73
- sitemap: {
74
- // options
75
- },
76
- }
77
- ```
78
-
79
- The module option parameter can be:
80
-
81
- ### `Object`
82
-
83
- A single item of [sitemap](#sitemap-options) or [sitemap index](#sitemap-index-options):
84
-
85
- ```js
86
- {
87
- sitemap: {
88
- // ...
89
- },
90
- }
91
- ```
92
-
93
- ### `Array`
94
-
95
- A list of [sitemap](#sitemap-options) or [sitemap index](#sitemap-index-options) items:
96
-
97
- ```js
98
- {
99
- sitemap: [
100
- {
101
- // ...
102
- },
103
- {
104
- // ...
105
- },
106
- ],
107
- }
108
- ```
109
-
110
- ### `Function`
111
-
112
- A function that returns a valid sitemap configuration:
113
-
114
- ```js
115
- {
116
- sitemap: function () {
117
- return {
118
- // ...
119
- }
120
- },
121
- }
122
- ```
123
-
124
- ### `Boolean`
125
-
126
- You can disable the sitemap module with a boolean value at `false`:
127
-
128
- ```js
129
- {
130
- sitemap: false
131
- }
132
- ```
133
-
134
- ## Usage
135
-
136
- ### Setup a Sitemap
137
-
138
- By default, the sitemap is setup to the following path: `/sitemap.xml`
139
- 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.
140
- 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.
141
-
142
- ```js
143
- // nuxt.config.js
144
-
145
- {
146
- sitemap: {
147
- hostname: 'https://example.com',
148
- gzip: true,
149
- exclude: [
150
- '/secret',
151
- '/admin/**'
152
- ],
153
- routes: [
154
- '/page/1',
155
- '/page/2',
156
- {
157
- url: '/page/3',
158
- changefreq: 'daily',
159
- priority: 1,
160
- lastmod: '2017-06-30T13:30:00.000Z'
161
- }
162
- ]
163
- }
164
- }
165
- ```
166
-
167
- ### Setup a Sitemap Index
168
-
169
- To declare a sitemap index and its linked sitemaps, use the [`sitemaps`](#sitemaps---array-of-object) property.
170
- By default, the sitemap index is setup to the following path: `/sitemapindex.xml`
171
- Each item of the `sitemaps` array can be setup with its own [sitemap options](#sitemap-options).
40
+ 💡 Need a more complete SEO solution for Nuxt? This module is included as part of [Nuxt SEO](https://nuxtseo.com).
172
41
 
173
- ```js
174
- // nuxt.config.js
42
+ 1. Install `@nuxtjs/sitemap` dependency to your project:
175
43
 
176
- {
177
- sitemap: {
178
- hostname: 'https://example.com',
179
- lastmod: '2017-06-30',
180
- sitemaps: [
181
- {
182
- path: '/sitemap-foo.xml',
183
- routes: ['foo/1', 'foo/2'],
184
- gzip: true
185
- }, {
186
- path: '/folder/sitemap-bar.xml',
187
- routes: ['bar/1', 'bar/2'],
188
- exclude: ['/**']
189
- }
190
- ]
191
- }
192
- }
44
+ ```bash
45
+ pnpm add -D @nuxtjs/sitemap
46
+ #
47
+ yarn add -D @nuxtjs/sitemap
48
+ #
49
+ npm install -D @nuxtjs/sitemap
193
50
  ```
194
51
 
195
- ### Setup a list of sitemaps
196
-
197
- To declare a list of sitemaps, use an `array` to setup each sitemap with its own configuration.
198
- You can combine sitemap and sitemap index configurations.
52
+ 2. Add it to your `modules` section in your `nuxt.config`:
199
53
 
200
- ```js
201
- // nuxt.config.js
202
-
203
- {
204
- sitemap: [
205
- {
206
- path: '/sitemap-products.xml',
207
- routes: [
208
- // array of URL
209
- ]
210
- }, {
211
- path: '/sitemap-news.xml',
212
- routes: () => // promise or function
213
- }, {
214
- path: '/sitemapindex.xml',
215
- sitemaps: [{
216
- // array of Sitemap configuration
217
- }]
218
- }
219
- }
220
- }
54
+ ```ts
55
+ export default defineNuxtConfig({
56
+ modules: ['@nuxtjs/sitemap']
57
+ })
221
58
  ```
222
59
 
223
- ## Sitemap Options
224
-
225
- ### `routes` (optional) - array | function
226
-
227
- - Default: `[]` or [`generate.routes`](https://nuxtjs.org/api/configuration-generate#routes) value from your `nuxt.config.js`
228
-
229
- The `routes` parameter follows the same way than the `generate` [configuration](https://nuxtjs.org/api/configuration-generate#routes).
230
-
231
- See as well the [routes declaration](#routes-declaration) examples below.
232
-
233
- ### `path` (optional) - string
234
-
235
- - Default: `/sitemap.xml`
236
-
237
- The URL path of the generated sitemap.
238
-
239
- ### `hostname` (optional) - string
240
-
241
- - Default:
242
- 1. `sitemap.hostname` value from your `nuxt.config.js`
243
- 2. [`build.publicPath`](https://nuxtjs.org/api/configuration-build/#publicpath) value from your `nuxt.config.js` (⚠️ **deprecated**)
244
- 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
245
-
246
- This value is **mandatory** for generation sitemap file, and you should explicitly provide it in **generate** or **spa** mode.
247
-
248
- ⚠️ The usage of `build.publicPath` as default value is deprecated and will be removed on release v3.0.
249
- To disable it on the current release, set a falsy value (eg. `hostname: false`).
250
-
251
- ### `cacheTime` (optional) - number
252
-
253
- - Default: `1000 * 60 * 15` (15 Minutes)
254
-
255
- Defines how frequently sitemap **routes** should be updated (value in milliseconds).
256
- Setting a negative value will disable the cache.
257
-
258
- Please note that after each invalidation, `routes` will be evaluated again (see [routes declaration](#routes-declaration) section).
259
-
260
- This option is only available in **ssr** mode.
261
-
262
- ### `etag` (optional) - object
263
-
264
- - Default: [`render.etag`](https://nuxtjs.org/api/configuration-render#etag) value from your `nuxt.config.js`
60
+ # Documentation
265
61
 
266
- Enable the etag cache header on sitemap (see [etag](https://nuxtjs.org/api/configuration-render#etag) docs for possible options).
62
+ [📖 Read the full documentation](https://nuxtseo.com/sitemap) for more information.
267
63
 
268
- To disable etag for sitemap set `etag: false`
64
+ ### StackBlitz Demos / Reproductions
269
65
 
270
- This option is only available in **ssr** mode.
271
-
272
- ### `exclude` (optional) - string array
273
-
274
- - Default: `[]`
275
-
276
- The `exclude` parameter is an array of [glob patterns](https://github.com/isaacs/minimatch#features) to exclude static routes from the generated sitemap.
277
-
278
- ### `filter` (optional) - function
279
-
280
- - Default: `undefined`
281
-
282
- If the `filter` option is set as a function, all routes will be filtered through it.
283
-
284
- This option is useful to customize or extend the features of the module, before the sitemap generation.
285
-
286
- Examples:
287
-
288
- ```js
289
- // nuxt.config.js
290
-
291
- // Filter routes by language
292
- {
293
- sitemap: {
294
- filter ({ routes, options }) {
295
- if (options.hostname === 'example.com') {
296
- return routes.filter(route => route.locale === 'en')
297
- }
298
- return routes.filter(route => route.locale === 'fr')
299
- }
300
- }
301
- }
302
-
303
- // Add a trailing slash to each route
304
- {
305
- sitemap: {
306
- filter ({ routes }) {
307
- return routes.map(route => {
308
- route.url = `${route.url}/`
309
- return route
310
- })
311
- }
312
- }
313
- }
314
- ```
315
-
316
- ### `gzip` (optional) - boolean
317
-
318
- - Default: `false`
319
-
320
- Enable the creation of the `.xml.gz` sitemap compressed with gzip.
321
-
322
- ### `xmlNs` (optional) - string
323
-
324
- - Default: `undefined`
325
-
326
- Set the XML namespaces by override all default `xmlns` attributes in `<urlset>` element.
327
-
328
- ```js
329
- // nuxt.config.js
330
-
331
- {
332
- sitemap: {
333
- xmlNs: 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"'
334
- }
335
- }
336
- ```
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)
337
70
 
338
- ### `xslUrl` (optional) - string
71
+ ## Sponsors
339
72
 
340
- - Default: `undefined`
341
-
342
- The URL path of the XSL file to style the sitemap.
343
-
344
- ### `trailingSlash` (optional) - boolean
345
-
346
- - Default: `false`
347
-
348
- Add a trailing slash to each route URL (eg. `/page/1` => `/page/1/`)
349
-
350
- > **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)).
351
-
352
- ### `i18n` (optional) - string | object
353
-
354
- - Default: `undefined`
355
-
356
- Configure the support of localized routes from **[nuxt-i18n](https://www.npmjs.com/package/nuxt-i18n)** module.
357
-
358
- 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)).
359
-
360
- Example:
361
-
362
- ```js
363
- // nuxt.config.js
364
-
365
- {
366
- modules: [
367
- 'nuxt-i18n',
368
- '@nuxtjs/sitemap'
369
- ],
370
- i18n: {
371
- locales: ['en', 'es', 'fr'],
372
- defaultLocale: 'en'
373
- },
374
- sitemap: {
375
- hostname: 'https://example.com',
376
- // shortcut notation (basic)
377
- i18n: true,
378
- // nuxt-i18n notation (advanced)
379
- i18n: {
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>
394
- <url>
395
- <loc>https://example.com/es/</loc>
396
- <xhtml:link rel="alternate" hreflang="en" href="https://example.com/"/>
397
- <xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/"/>
398
- <xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/"/>
399
- </url>
400
- <url>
401
- <loc>https://example.com/fr/</loc>
402
- <xhtml:link rel="alternate" hreflang="en" href="https://example.com/"/>
403
- <xhtml:link rel="alternate" hreflang="es" href="https://example.com/es/"/>
404
- <xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/"/>
405
- </url>
406
- ```
407
-
408
- ### `defaults` (optional) - object
409
-
410
- - Default: `{}`
411
-
412
- The `defaults` parameter set the default options for all routes.
413
-
414
- ```js
415
- // nuxt.config.js
416
-
417
- {
418
- sitemap: {
419
- defaults: {
420
- changefreq: 'daily',
421
- priority: 1,
422
- lastmod: new Date()
423
- }
424
- }
425
- }
426
- ```
427
-
428
- See available options: https://github.com/ekalinin/sitemap.js/blob/4.1.1/README.md#sitemap-item-options
429
-
430
- ## Sitemap Index Options
431
-
432
- ### `path` (optional) - string
433
-
434
- - Default: `/sitemapindex.xml`
435
-
436
- The URL path of the generated sitemap index.
437
-
438
- ### `hostname` (optional) - string
439
-
440
- Set the `hostname` value to each sitemap linked to its sitemap index.
441
-
442
- ### `sitemaps` - array of object
443
-
444
- - Default: `[]`
445
-
446
- Array of [sitemap configuration](#sitemap-options]) linked to the sitemap index.
447
-
448
- ```js
449
- // nuxt.config.js
450
-
451
- {
452
- sitemap: {
453
- path: '/sitemapindex.xml',
454
- hostname: 'https://example.com',
455
- sitemaps: [
456
- {
457
- path: '/sitemap-foo.xml',
458
- // ...
459
- }, {
460
- path: '/folder/sitemap-bar.xml',
461
- // ...
462
- }
463
- ]
464
- }
465
- }
466
- ```
467
-
468
- ```xml
469
- <!-- generated sitemapindex.xml -->
470
-
471
- <?xml version="1.0" encoding="UTF-8"?>
472
- <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
473
- <sitemap>
474
- <loc>https://example.com/sitemap-foo.xml</loc>
475
- </sitemap>
476
- <sitemap>
477
- <loc>https://example.com/folder/sitemap-bar.xml</loc>
478
- </sitemap>
479
- </sitemapindex>
480
- ```
481
-
482
- See more [examples](#usage) above.
483
-
484
- ### `lastmod` (optional) - string
485
-
486
- Set the `lastmod` value to each sitemap linked to its sitemap index.
487
-
488
- In addition, the `lastmod` can be defined for each linked sitemap.
489
-
490
- ```js
491
- // nuxt.config.js
492
-
493
- {
494
- sitemap: {
495
- lastmod: "2020-01-01",
496
- sitemaps: [
497
- {
498
- path: '/sitemap-foo.xml',
499
- lastmod: "2020-01-02"
500
- }, {
501
- path: '/sitemap-bar.xml'
502
- }
503
- ]
504
- }
505
- }
506
- ```
507
-
508
- ### `etag` (optional) - object
509
-
510
- - Default: [`render.etag`](https://nuxtjs.org/api/configuration-render#etag) value from your `nuxt.config.js`
511
-
512
- Enable the etag cache header on sitemap index (See [etag](https://nuxtjs.org/api/configuration-render#etag) docs for possible options).
513
-
514
- To disable etag for sitemap index set `etag: false`
515
-
516
- This option is only available in **ssr** mode.
517
-
518
- ### `gzip` (optional) - boolean
519
-
520
- - Default: `false`
521
-
522
- Enable the creation of the `.xml.gz` sitemap index compressed with gzip.
523
-
524
- ### `xmlNs` (optional) - string
525
-
526
- - Default: `undefined`
527
-
528
- Set the XML namespaces by override all default `xmlns` attributes in `<sitemapindex>` element.
529
-
530
- ```js
531
- // nuxt.config.js
532
-
533
- {
534
- sitemap: {
535
- xmlNs: 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"',
536
- sitemaps: [...]
537
- }
538
- }
539
- ```
540
-
541
- ### `xslUrl` (optional) - string
542
-
543
- - Default: `undefined`
544
-
545
- The URL path of the XSL file to style the sitemap index.
546
-
547
- ## Routes Declaration
548
-
549
- By default, the dynamic routes are ignored by the sitemap module.
550
- Nuxt cannot automatically provide this type of complex routes.
551
-
552
- Example:
553
-
554
- ```
555
- -| pages/
556
- ---| index.vue --> static route
557
- ---| about.vue --> static route
558
- ---| users/
559
- -----| _id.vue --> dynamic route
560
- ```
561
-
562
- If you want the module to add any route with dynamic parameters, you have to set an array of dynamic routes.
563
-
564
- eg. add routes for `/users/:id` in the configuration:
565
-
566
- ### From a static list
567
-
568
- ```js
569
- // nuxt.config.js
570
-
571
- {
572
- sitemap: {
573
- routes: ['/users/1', '/users/2', '/users/3']
574
- }
575
- }
576
- ```
577
-
578
- ### From a function which returns a Promise
579
-
580
- ```js
581
- // nuxt.config.js
582
-
583
- const axios = require('axios')
584
-
585
- {
586
- sitemap: {
587
- routes: async () => {
588
- const { data } = await axios.get('https://jsonplaceholder.typicode.com/users')
589
- return data.map((user) => `/users/${user.username}`)
590
- }
591
- }
592
- }
593
- ```
594
-
595
-
596
- ## Hooks
597
-
598
- Hooks are listeners to Nuxt events. [Learn more](https://nuxtjs.org/api/configuration-hooks)
599
-
600
- You can register hooks on certain life cycle events.
601
-
602
- | Hook | Arguments | When |
603
- |---|---|---|
604
- | sitemap:generate:before | (nuxt, sitemapOptions) | Hook on before site generation |
605
- | sitemap:generate:done | (nuxt) | Hook on sitemap generation finished |
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>
606
78
 
607
79
  ## License
608
80
 
609
- [MIT License](./LICENSE)
610
-
611
- ## Contributors
612
-
613
- - [Nicolas Pennec](https://github.com/NicoPennec)
614
- - [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>