-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add robots.txt * add to hosting guide * add sitemap.xml and script
- Loading branch information
1 parent
9e8b52d
commit 74bed78
Showing
5 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { sitemapBuilder as buildSitemap } from "react-router-sitemap"; | ||
|
||
var fs = require("fs"); | ||
|
||
const regex = /pages: (\[[\w\W]+?\])/gm; | ||
|
||
let source = regex.exec(fs.readFileSync("./apps/official/index.ts").toString())[1]; | ||
//console.log(source); | ||
|
||
let ignorePaths = ["questions"]; | ||
let pathPrefix = "/#/"; | ||
|
||
var paths = source | ||
.split(",") | ||
.map((x) => x.split(":").map((y) => y.trim())) | ||
.reduce((a, x) => { | ||
if (x[0] == "route") { | ||
let route = x[1].replace(/["'/]/g, ""); | ||
if (ignorePaths.findIndex((p) => route === p) == -1) { | ||
a.push(pathPrefix + route); | ||
} | ||
} | ||
return a; | ||
}, []); | ||
|
||
const hostname = "https://www.covmap.de"; | ||
const sitemap = buildSitemap(hostname, paths); | ||
console.log(sitemap); | ||
|
||
const { createWriteStream } = require("fs"); | ||
const { SitemapStream } = require("sitemap"); | ||
|
||
// Creates a sitemap object given the input configuration with URLs | ||
const sitemapSteam = new SitemapStream(sitemap); | ||
|
||
const writeStream = createWriteStream("./static/sitemap.xml"); | ||
sitemapSteam.pipe(writeStream); | ||
paths.forEach((path) => { | ||
sitemapSteam.write(path); | ||
}); | ||
|
||
sitemapSteam.end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
User-Agent: * | ||
Disallow: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"><url><loc>https://www.covmap.de/#/charts</loc></url><url><loc>https://www.covmap.de/#/faq</loc></url><url><loc>https://www.covmap.de/#/credits</loc></url><url><loc>https://www.covmap.de/#/imprint</loc></url><url><loc>https://www.covmap.de/#/legal</loc></url><url><loc>https://www.covmap.de/#/privacy-statement</loc></url><url><loc>https://www.covmap.de/#/recommendations</loc></url><url><loc>https://www.covmap.de/#/rki</loc></url><url><loc>https://www.covmap.de/#/contact-behavior</loc></url><url><loc>https://www.covmap.de/#/symptom-level</loc></url></urlset> |