From 2b645468e95b61e4dbee24238aa346be5cb84f92 Mon Sep 17 00:00:00 2001 From: Daniel Habenicht Date: Fri, 27 Nov 2020 18:52:28 +0100 Subject: [PATCH 1/3] add robots.txt --- static/robots.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 static/robots.txt diff --git a/static/robots.txt b/static/robots.txt new file mode 100644 index 00000000..0ad279c7 --- /dev/null +++ b/static/robots.txt @@ -0,0 +1,2 @@ +User-Agent: * +Disallow: From 98cbc53a3cd5d0389c9a1185ce57c0c27efeaa30 Mon Sep 17 00:00:00 2001 From: Daniel Habenicht Date: Fri, 27 Nov 2020 18:53:10 +0100 Subject: [PATCH 2/3] add to hosting guide --- hosting/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hosting/README.md b/hosting/README.md index e795346c..6a117d96 100644 --- a/hosting/README.md +++ b/hosting/README.md @@ -1,3 +1,13 @@ +## Setup + +# Preparation + +Get a `Ubuntu 20.04.1 LTS` Server (e.g. 2 cores 4 GB RAM) + +1. [Install Docker](https://docs.docker.com/engine/install/ubuntu/) +2. [Install Docker Compose](https://docs.docker.com/compose/install/) +3. Clone this repo + # First Startup 1. `chmod +x setup.sh` From 72cf51a2b9b102680cf5d97722f0624b46045d9e Mon Sep 17 00:00:00 2001 From: Daniel Habenicht Date: Sat, 28 Nov 2020 14:53:28 +0100 Subject: [PATCH 3/3] add sitemap.xml and script --- create-sitemap.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ package.json | 2 ++ static/sitemap.xml | 1 + 3 files changed, 45 insertions(+) create mode 100644 create-sitemap.ts create mode 100644 static/sitemap.xml diff --git a/create-sitemap.ts b/create-sitemap.ts new file mode 100644 index 00000000..6667b4a4 --- /dev/null +++ b/create-sitemap.ts @@ -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(); diff --git a/package.json b/package.json index 915cb63d..510ffc63 100644 --- a/package.json +++ b/package.json @@ -95,10 +95,12 @@ "prettier": "2.1.2", "react-hot-loader": "^4.12.20", "react-map-gl": "^5.2.3", + "react-router-sitemap": "^1.2.0", "react-test-renderer": "^16.13.1", "redux-persist": "^6.0.0", "redux-persist-transform-filter": "^0.0.20", "semantic-release": "^17.2.1", + "sitemap": "^6.3.3", "style-loader": "^1.1.3", "testcafe": "^1.9.4", "testcafe-browser-provider-browserstack": "^1.13.1", diff --git a/static/sitemap.xml b/static/sitemap.xml new file mode 100644 index 00000000..778d8195 --- /dev/null +++ b/static/sitemap.xml @@ -0,0 +1 @@ +https://www.covmap.de/#/chartshttps://www.covmap.de/#/faqhttps://www.covmap.de/#/creditshttps://www.covmap.de/#/imprinthttps://www.covmap.de/#/legalhttps://www.covmap.de/#/privacy-statementhttps://www.covmap.de/#/recommendationshttps://www.covmap.de/#/rkihttps://www.covmap.de/#/contact-behaviorhttps://www.covmap.de/#/symptom-level \ No newline at end of file