aboutsummaryrefslogtreecommitdiff
path: root/www/html/redirects.js
diff options
context:
space:
mode:
authorValentin <valentin@fricklerhandwerk.de>2025-11-13 00:08:38 +0100
committerValentin <valentin@fricklerhandwerk.de>2025-11-13 00:08:40 +0100
commit942b7e2077e1673afebf626fcc33a2186e46444b (patch)
treeada4c5cfb3cc02ec41c839a19ce4f86f9988be86 /www/html/redirects.js
parent7a0c88e65e8d85dc0970654465406d6877dd0508 (diff)
Seite für Termine, die in der Vergangenheit liegen
Dieser Aufbau unterstützt Umleitungen, sodass alte Links gültig bleiben.
Diffstat (limited to 'www/html/redirects.js')
-rw-r--r--www/html/redirects.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/www/html/redirects.js b/www/html/redirects.js
new file mode 100644
index 0000000..789dedb
--- /dev/null
+++ b/www/html/redirects.js
@@ -0,0 +1,18 @@
+const redirects = {
+};
+
+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;
+ }
+}