Skip to content
Permalink
Browse files

feat(404): auto fill search box with URL fragment that was not found

Signed-off-by: Pablo Iranzo Gómez <Pablo.Iranzo@gmail.com>
  • Loading branch information...
iranzo authored and talha131 committed Aug 5, 2019
1 parent e8c5578 commit c0a7f47584b0f70e7d491e4c05094b4e0c8ae04e
Showing with 18 additions and 1 deletion.
  1. +18 −1 templates/404.html
@@ -14,7 +14,6 @@ <h1>That page doesn't exist!</h1>
</header>
</div>


<div class="row-fluid">
<div class="span8 offset2">
<p>Sorry, but the page you are looking for cannot be found. It seems that the page you were trying to reach doesn't exist, or may be it has just moved, or it no longer exists.</p>
@@ -28,4 +27,22 @@ <h1>That page doesn't exist!</h1>
</div>
</div>
</div>

<script type="text/javascript">
// Get Current location as the initial search item
var newurl = (' ' + window.location.pathname).slice(1);
// Replace "/" in path into spaces
var newurl = newurl.replace(/\//g, ' ');
// Remove html extension
var newurl = newurl.replace(/.html/g, ' ');
// Replace - by ' '
var newurl = newurl.replace(/\-/g, ' ');
// Fill search field with resulting string
document.getElementById('tipue_search_input_404').value = newurl;
</script>

{% endblock content %}

0 comments on commit c0a7f47

Please sign in to comment.
You can’t perform that action at this time.