aboutsummaryrefslogtreecommitdiff
path: root/www/html/redirects.js
blob: 4bca0c5aeaa7cf59c5a4fdf99827f9fcdd09ea45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const redirects = {
  "index.html": {
    "2025-11-heimfeld-leuchtet": "vergangene-termine.html#2025-11-heimfeld-leuchtet",
    "2025-11-geklaute-jugend": "vergangene-termine.html#2025-11-geklaute-jugend"
  }
};

let segments = document.location.pathname.split('/');
// Das erste Element ist immer `''`
segments.splice(0, 1);
let file = segments.pop();
if (file === '') { file = "index.html"; }
segments.push(file);
const path = segments.join('/');
const anchor = document.location.hash.substring(1);
const redirect = redirects[path];
if (redirect) {
  const target = redirect[anchor];
  if (target) {
    document.location.href = target;
  }
}