Skip to content

Commit

Permalink
feat(404): auto fill search box with URL fragment that was not found
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Iranzo Gómez <Pablo.Iranzo@gmail.com>
  • Loading branch information
iranzo authored and talha131 committed Aug 14, 2019
1 parent e8c5578 commit c0a7f47
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion templates/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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.