vite-plugin-sitemap 0.8.2 → 0.10.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 (5) hide show
  1. package/README.md +12 -3
  2. package/dist/index.d.ts +20 -3
  3. package/dist/index.js +8891 -10741
  4. package/dist/index.mjs +8891 -10741
  5. package/package.json +23 -14
package/README.md CHANGED
@@ -89,7 +89,9 @@ Array of strings with excluded routes.
89
89
  export default {
90
90
  plugins: [
91
91
  Vue(),
92
- Sitemap({ exclude: ['/admin', '/private'] }),
92
+ Sitemap({
93
+ exclude: ['/admin', '/private']
94
+ }),
93
95
  ],
94
96
  }
95
97
  ```
@@ -105,7 +107,12 @@ Array of strings with other sitemaps paths or urls.
105
107
 
106
108
  ```js
107
109
  generateSitemap({
108
- externalSitemaps: ['sitemap_1', 'sitemap_2', 'subpath/sitemap_3', 'https://site.com/sitemap.xml']
110
+ externalSitemaps: [
111
+ 'sitemap_1',
112
+ 'sitemap_2',
113
+ 'subpath/sitemap_3',
114
+ 'https://site.com/sitemap.xml'
115
+ ]
109
116
  })
110
117
  ```
111
118
 
@@ -161,13 +168,15 @@ Converts XML into a human readable format
161
168
 
162
169
  ### i18n
163
170
 
164
- - **Type:** `{ defaultLanguage?: string, languages: string[], strategy?: 'suffix' | 'prefix' }`
171
+ - **Type:** `{ defaultLanguage?: string, languages: string[], strategy?: 'suffix' | 'prefix' | 'prefix_except_default', includeDefaultLanguageInURL?: boolean }`
165
172
  - **Default:** `undefined, strategy: 'suffix'`
166
173
 
167
174
  Add i18n support defining alternate links.
168
175
  defaultLanguage will use this language with / and languages with /language.
169
176
  strategy specifies if the language code is a suffix to the path or a prefix. 'suffix' is default. Example: http://localhost/mypage/en or http://localhost/en/mypage
170
177
 
178
+ Set `includeDefaultLanguageInURL: true` to also apply the strategy to the default language. In that case, `<loc>`, the default-language alternate, and `x-default` all point to the localized URL (e.g. http://localhost/en/mypage instead of http://localhost/mypage). Useful when every page is served under a language prefix, as recommended by [Google](https://developers.google.com/search/docs/specialty/international/localized-versions#example_2).
179
+
171
180
  ### generateRobotsTxt
172
181
 
173
182
  - **Type:** `boolean`
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  interface NSArgs {
3
2
  news: boolean;
4
3
  video: boolean;
@@ -6,7 +5,6 @@ interface NSArgs {
6
5
  image: boolean;
7
6
  custom?: string[];
8
7
  }
9
-
10
8
  interface RobotOption {
11
9
  /**
12
10
  * User-agent value.
@@ -70,7 +68,17 @@ interface Options {
70
68
  i18n?: {
71
69
  defaultLanguage?: string;
72
70
  languages: string[];
73
- strategy?: 'suffix' | 'prefix';
71
+ strategy?: 'suffix' | 'prefix' | 'prefix_except_default';
72
+ /**
73
+ * When true, the `<loc>` URL and the default-language alternate
74
+ * (and `x-default`) are built with the strategy applied to the
75
+ * default language too, producing URLs like `/<defaultLang>/route`
76
+ * (prefix) or `/route/<defaultLang>` (suffix).
77
+ * Only applies when `strategy` is 'prefix' or 'suffix' and
78
+ * `defaultLanguage` is set.
79
+ * @default false
80
+ */
81
+ includeDefaultLanguageInURL?: boolean;
74
82
  };
75
83
  /**
76
84
  * Other sitemaps paths
@@ -131,6 +139,15 @@ interface Options {
131
139
  * @default undefined
132
140
  */
133
141
  xmlns?: NSArgs;
142
+ /**
143
+ * Split threshold. When the number of URLs exceeds this value,
144
+ * `sitemap.xml` becomes a sitemap index pointing to `sitemap-1.xml`,
145
+ * `sitemap-2.xml`, etc. Below the threshold a single `sitemap.xml`
146
+ * is produced (previous behavior). The sitemap protocol requires
147
+ * at most 50 000 URLs per file.
148
+ * @default 45000
149
+ */
150
+ splitAt: number;
134
151
  }
135
152
  type UserOptions = Partial<Options>;
136
153