logo

Grimgrains

[mirror] Plant-based cooking website <https://grimgrains.com/>
commit: 05b67a6e16244baa229cb08e1fce255f78ce7db2
parent 04389e438e5ec7972be9c6f470af532d690156ec
Author: microlith57 <microlith57@gmail.com>
Date:   Fri, 14 Jun 2019 10:08:43 +1200

Fix bug where the '#' would be escaped

oops

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

Diffstat:

M404.html7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/404.html b/404.html @@ -30,17 +30,20 @@ permalink: /404.html </head> <body style='background:black; color:white'> <script> + // Find current path (relative to grimgrains.com) var parts = window.location.pathname.split('/') var target = []; + + // Fancy slugify regex bit 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('+'); + var target = parts.join('+'); // Rejoin path - document.location.pathname = "/#"+target + document.location.href = document.location.origin + "/#"+ target // Go to grimgrains.com/#target </script> <h1 class="fadein">