Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add seo relevant files #376

Merged
merged 3 commits into from
Nov 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions create-sitemap.ts
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();
10 changes: 10 additions & 0 deletions hosting/README.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions static/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-Agent: *
Disallow:
1 change: 1 addition & 0 deletions static/sitemap.xml
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>