Skip to content

Commit 1542cad

Browse files
rbpiC85297
andauthored
Update Sitemap URLs to Use Valid Paths in sitemap.mjs (#1861)
Co-authored-by: C85297 <95289555+C85297@users.noreply.github.com>
1 parent 64399ad commit 1542cad

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/web/static/sitemap.mjs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import sm from "sitemap";
2-
import OperationConfig from "../../core/config/OperationConfig.json" assert {type: "json"};
3-
2+
import OperationConfig from "../../core/config/OperationConfig.json" assert { type: "json" };
43

54
/**
65
* Generates an XML sitemap for all CyberChef operations and a number of recipes.
@@ -10,25 +9,25 @@ import OperationConfig from "../../core/config/OperationConfig.json" assert {typ
109
* @license Apache-2.0
1110
*/
1211

13-
const smStream = new sm.SitemapStream({
14-
hostname: "https://gchq.github.io/CyberChef",
15-
});
12+
const baseUrl = "https://gchq.github.io/CyberChef/";
13+
14+
const smStream = new sm.SitemapStream({});
1615

1716
smStream.write({
18-
url: "/",
17+
url: baseUrl,
1918
changefreq: "weekly",
20-
priority: 1.0
19+
priority: 1.0,
2120
});
2221

2322
for (const op in OperationConfig) {
2423
smStream.write({
25-
url: `/?op=${encodeURIComponent(op)}`,
24+
url: `${baseUrl}?op=${encodeURIComponent(op)}`,
2625
changeFreq: "yearly",
27-
priority: 0.5
26+
priority: 0.5,
2827
});
2928
}
3029
smStream.end();
3130

3231
sm.streamToPromise(smStream).then(
33-
buffer => console.log(buffer.toString()) // eslint-disable-line no-console
32+
(buffer) => console.log(buffer.toString()), // eslint-disable-line no-console
3433
);

0 commit comments

Comments
 (0)