logo

Grimgrains

[mirror] Plant-based cooking website <https://grimgrains.com/>
commit: 04389e438e5ec7972be9c6f470af532d690156ec
parent ac79451752a33c81380e05834e29a4b29c1b411d
Author: microlith57 <microlith57@gmail.com>
Date:   Fri, 14 Jun 2019 09:59:03 +1200

Fix redirection logic

(hopefully)

Signed-off-by:
microlith57 <microlith57@gmail.com>

Diffstat:

M404.html15+++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/404.html b/404.html @@ -30,10 +30,17 @@ permalink: /404.html </head> <body style='background:black; color:white'> <script> - var parts = window.location.pathname.split("/") - var target = parts.slice(-1); - parts.splice(-1) - document.location.href = parts.join("/")+"/#"+target + var parts = window.location.pathname.split('/') + var target = []; + parts.foreach(function(elem) { + elem = elem.toLowerCase(); + elem = elem.replace(/[\s·/_'",:;\.-]+/g, '+'); // Replace whitespace and "·/_'",:;.-" to "+" + elem = elem.replace(/^\++|\++$/g, ''); // Remove "+"es at start and end + target.push(elem); + }); + var target = parts.join('+'); + + document.location.pathname = "/#"+target </script> <h1 class="fadein">