diff options
Diffstat (limited to 'www/html/redirects.js')
| -rw-r--r-- | www/html/redirects.js | 18 |
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; + } +} |
