-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Expand file tree
/
Copy pathsitemap.mjs
More file actions
33 lines (27 loc) · 808 Bytes
/
sitemap.mjs
File metadata and controls
33 lines (27 loc) · 808 Bytes
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
import sm from "sitemap";
import OperationConfig from "../../core/config/OperationConfig.json" with { type: "json" };
/**
* Generates an XML sitemap for all CyberChef operations and a number of recipes.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
const baseUrl = "https://gchq.github.io/CyberChef/";
const smStream = new sm.SitemapStream({});
smStream.write({
url: baseUrl,
changefreq: "weekly",
priority: 1.0,
});
for (const op in OperationConfig) {
smStream.write({
url: `${baseUrl}?op=${encodeURIComponent(op)}`,
changeFreq: "yearly",
priority: 0.5,
});
}
smStream.end();
sm.streamToPromise(smStream).then(
(buffer) => console.log(buffer.toString()), // eslint-disable-line no-console
);