-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·44 lines (36 loc) · 1.16 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Include our Plugins
const gulp = require("gulp"),
SimpleSitemapGenerator = require("./src/SitemapGenerator");
// Compile JavaScript
gulp.task("Sitemap", function(cb) {
var generator = new SimpleSitemapGenerator("https://www.example.com", {
changefreq: "weekly",
priority: 0.5,
interval: 500,
maxConcurrency: 5,
stripQuerystring: true,
ignoreInvalidSSL: true,
restrictToBasepath: false,
maxEntriesPerFile: 50000,
maxDepth: 0,
filepath: "./sitemap123.xml",
ignore: url => {
return url.indexOf("/page-to-ignore") != -1;
}
});
generator.on("fetchcomplete", item => {
if (item.loc == "https://www.example.com/") {
item.priority = 0.8;
} else if (item.loc.indexOf("/page-1") != -1) {
item.priority = 0.8;
} else if (item.loc.indexOf("/page-2") != -1) {
item.priority = 0.5;
}
console.log("fetch: " + item.loc + " -> priority: " + item.priority);
});
generator.on("complete", (sitemap, items) => {
console.log("complete");
cb();
});
generator.start();
});