mirror of
https://github.com/dzeiocom/markblog.git
synced 2025-04-22 10:52:12 +00:00
added sitemap generator script
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
parent
fc41b2c0f1
commit
aa53548089
20
scripts/generateSitemap.js
Normal file
20
scripts/generateSitemap.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
const glob = require('glob')
|
||||||
|
const fs = require('fs')
|
||||||
|
|
||||||
|
// DOMAIN NAME WITHOUT THE LAST /
|
||||||
|
const domain = "https://www.avior.me"
|
||||||
|
|
||||||
|
const files = glob.sync('./out/**/*.html')
|
||||||
|
let res = `<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">`
|
||||||
|
|
||||||
|
for (let file of files) {
|
||||||
|
file = file.replace("./out", "").replace("index.html", "")
|
||||||
|
res += `<url><loc>${domain}${file}</loc></url>`
|
||||||
|
}
|
||||||
|
|
||||||
|
res += `</urlset>`
|
||||||
|
fs.writeFileSync('./out/sitemap.xml', res)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
console.log(res)
|
Loading…
x
Reference in New Issue
Block a user