made sitemap generation properly dynamic
This commit is contained in:
parent
7aced5c274
commit
4c36f505ba
1 changed files with 38 additions and 39 deletions
|
@ -5,6 +5,7 @@ const {
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
|
||||||
let app = express();
|
let app = express();
|
||||||
|
app.get('/sitemap.xml', function (_req, res) {
|
||||||
let sitemap = createSitemap({
|
let sitemap = createSitemap({
|
||||||
hostname: 'https://ellpeck.de',
|
hostname: 'https://ellpeck.de',
|
||||||
urls: [{
|
urls: [{
|
||||||
|
@ -39,11 +40,9 @@ fs.readFile(__dirname + "/../blog/posts.json", function (_, data) {
|
||||||
priority: 0.4
|
priority: 0.4
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
app.get('/sitemap.xml', function (_req, res) {
|
|
||||||
let xml = sitemap.toXML();
|
|
||||||
res.header('Content-Type', 'application/xml');
|
res.header('Content-Type', 'application/xml');
|
||||||
res.send(xml);
|
res.send(sitemap.toXML());
|
||||||
|
});
|
||||||
});
|
});
|
||||||
app.listen(3000);
|
app.listen(3000);
|
Loading…
Reference in a new issue