vite-plugin-sitemap-ts 1.1.2 → 1.1.3
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.
- package/README.md +44 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
A Vite plugin to generate `sitemap.xml`. Works in development mode by proxying middleware to `/sitemap.xml`.
|
|
4
4
|
|
|
5
5
|
> [!IMPORTANT]
|
|
6
|
-
> This plugin requires you to manually define `routes`. It does not automatically scan your build
|
|
6
|
+
> This plugin requires you to manually define `routes`. It does not automatically scan your build!
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
@@ -25,10 +25,53 @@ export default {
|
|
|
25
25
|
plugins: [
|
|
26
26
|
sitemap({
|
|
27
27
|
hostname: 'https://example.com',
|
|
28
|
+
routes: ['/', '/about'],
|
|
28
29
|
}),
|
|
29
30
|
],
|
|
30
31
|
}
|
|
31
32
|
```
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
### Without routes:
|
|
36
|
+
|
|
37
|
+
The plugin will generate a root route ("/") when the `routes` option is omitted.
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
sitemap({
|
|
41
|
+
hostname: 'https://example.com',
|
|
42
|
+
})
|
|
43
|
+
```
|
|
44
|
+
*Output:*
|
|
45
|
+
```xml
|
|
46
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
47
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
48
|
+
<url>
|
|
49
|
+
<loc>https://example.com/</loc>
|
|
50
|
+
<lastmod>2026-03-14T19:27:44.429Z</lastmod>
|
|
51
|
+
</url>
|
|
52
|
+
</urlset>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### With routes:
|
|
56
|
+
|
|
57
|
+
The plugin will generate only those routes which have been defined by the `routes` option.
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
sitemap({
|
|
61
|
+
hostname: 'https://example.com',
|
|
62
|
+
routes: ['/about'],
|
|
63
|
+
})
|
|
64
|
+
```
|
|
65
|
+
*Output:*
|
|
66
|
+
```xml
|
|
67
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
68
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
69
|
+
<url>
|
|
70
|
+
<loc>https://example.com/about</loc>
|
|
71
|
+
<lastmod>2026-03-14T19:42:17.729Z</lastmod>
|
|
72
|
+
</url>
|
|
73
|
+
</urlset>
|
|
74
|
+
```
|
|
32
75
|
|
|
33
76
|
## Options
|
|
34
77
|
|
package/package.json
CHANGED