vite-plugin-sitemap 0.1.1 → 0.1.4
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 +28 -1
- package/dist/index.d.ts +2 -79
- package/dist/index.js +8099 -3551
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8092 -3556
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -18
package/README.md
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
[](https://github.com/jbaubree/vite-plugin-sitemap/blob/main/LICENSE)
|
|
7
7
|
[](https://github.com/jbaubree/vite-plugin-sitemap/actions/workflows/ci.yml)
|
|
8
8
|
|
|
9
|
-
> Sitemap generator plugin for Vite
|
|
9
|
+
> Sitemap generator plugin for Vite using [sitemap-ts](https://github.com/jbaubree/sitemap-ts).
|
|
10
|
+
|
|
11
|
+
> This plugin scans your dist folder next build to generate sitemap.xml and robots.txt files.
|
|
10
12
|
|
|
11
13
|
## Getting Started
|
|
12
14
|
|
|
@@ -35,6 +37,14 @@ export default {
|
|
|
35
37
|
|
|
36
38
|
Now, run `npm build` and this will generate sitemap.xml and robots.txt files on your dist folder.
|
|
37
39
|
|
|
40
|
+
### To generate all pages of your app, you can:
|
|
41
|
+
- Use dynamicRoutes to send routes paths.
|
|
42
|
+
- Read [`MPA docs`](https://vitejs.dev/guide/build.html#multi-page-app) from Vite documentation.
|
|
43
|
+
- Use MPA with [`vite-plugin-mpa`](https://github.com/IndexXuan/vite-plugin-mpa).
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Configuration options
|
|
47
|
+
|
|
38
48
|
### hostname
|
|
39
49
|
|
|
40
50
|
- **Type:** `string`
|
|
@@ -67,6 +77,23 @@ export default {
|
|
|
67
77
|
|
|
68
78
|
You can find a working example in example folder.
|
|
69
79
|
|
|
80
|
+
### exclude
|
|
81
|
+
|
|
82
|
+
- **Type:** `string[]`
|
|
83
|
+
- **Default:** `[]`
|
|
84
|
+
|
|
85
|
+
Array of strings with excluded routes.
|
|
86
|
+
```js
|
|
87
|
+
export default {
|
|
88
|
+
plugins: [
|
|
89
|
+
Vue(),
|
|
90
|
+
Sitemap({ exclude: ['/admin', '/private'] }),
|
|
91
|
+
],
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
You can find a working example in example folder.
|
|
96
|
+
|
|
70
97
|
### outDir
|
|
71
98
|
|
|
72
99
|
- **Type:** `string`
|
package/dist/index.d.ts
CHANGED
|
@@ -1,83 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
+
import { UserOptions } from 'sitemap-ts';
|
|
2
3
|
|
|
3
|
-
interface RobotOption {
|
|
4
|
-
/**
|
|
5
|
-
* User-agent value.
|
|
6
|
-
* Example: Googlebot
|
|
7
|
-
*/
|
|
8
|
-
userAgent: string;
|
|
9
|
-
/**
|
|
10
|
-
* Allowed routes for corresponding User-agent.
|
|
11
|
-
* Example: '/'
|
|
12
|
-
*/
|
|
13
|
-
allow?: string | string[];
|
|
14
|
-
/**
|
|
15
|
-
* Disallowed routes for corresponding User-agent.
|
|
16
|
-
* Example: ['/admin', '/confidential']
|
|
17
|
-
*/
|
|
18
|
-
disallow?: string | string[];
|
|
19
|
-
/**
|
|
20
|
-
* Crawl-delay option for robot.
|
|
21
|
-
* Example: 2
|
|
22
|
-
*/
|
|
23
|
-
crawlDelay?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Clean-param option for robot.
|
|
26
|
-
* Example: 'ref /articles/'
|
|
27
|
-
*/
|
|
28
|
-
cleanParam?: string;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Plugin options.
|
|
32
|
-
*/
|
|
33
|
-
interface Options {
|
|
34
|
-
/**
|
|
35
|
-
* Base URI
|
|
36
|
-
* @default 'http://localhost/'
|
|
37
|
-
*/
|
|
38
|
-
hostname: string;
|
|
39
|
-
/**
|
|
40
|
-
* Array of strings with dynamic routes.
|
|
41
|
-
* Example: ['/routes1', '/route2/sub-route']
|
|
42
|
-
* @default []
|
|
43
|
-
*/
|
|
44
|
-
dynamicRoutes: string[];
|
|
45
|
-
/**
|
|
46
|
-
* Output directory
|
|
47
|
-
* @default 'dist'
|
|
48
|
-
*/
|
|
49
|
-
outDir: string;
|
|
50
|
-
/**
|
|
51
|
-
* Change frequency option for sitemap
|
|
52
|
-
* @default 'daily'
|
|
53
|
-
*/
|
|
54
|
-
changefreq: string;
|
|
55
|
-
/**
|
|
56
|
-
* Priority option for sitemap
|
|
57
|
-
* @default 1
|
|
58
|
-
*/
|
|
59
|
-
priority: number;
|
|
60
|
-
/**
|
|
61
|
-
* Last modification option for sitemap
|
|
62
|
-
* @default new Date()
|
|
63
|
-
*/
|
|
64
|
-
lastmod: Date;
|
|
65
|
-
/**
|
|
66
|
-
* Converts XML into a human readable format
|
|
67
|
-
* @default false
|
|
68
|
-
*/
|
|
69
|
-
readable: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Robots policy
|
|
72
|
-
* @default [{ userAgent: '*', allow: '/' }]
|
|
73
|
-
*/
|
|
74
|
-
robots: RobotOption[];
|
|
75
|
-
}
|
|
76
|
-
declare type UserOptions = Partial<Options>;
|
|
77
|
-
interface ResolvedOptions extends Options {
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
declare function generateSitemap(options?: UserOptions): void;
|
|
81
4
|
declare function sitemapPlugin(options?: UserOptions): Plugin;
|
|
82
5
|
|
|
83
|
-
export {
|
|
6
|
+
export { sitemapPlugin as default };
|