-
Notifications
You must be signed in to change notification settings - Fork 0
/
404.html
39 lines (35 loc) · 1.25 KB
/
404.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
permalink: /404.html
layout: default
title: "404"
id: "not-found"
---
<div>
<h1 id="title"><span id="page-name">Page</span> not found. 🙈</h1>
<p>This page doesn't exist yet. <a href="{{ site.baseurl }}/">Return home</a> to get a fresh start.</p>
<div id="create-link-wrapper" hidden>Or <a id="create-link" href="{{ site.new_file_base }}">create this page.</a></div>
</div>
<script>
// Change 404 page at runtime based on url
function createLink(wrapper, link) {
let location = window.location.pathname;
location = location.replace("{{ site.baseurl }}", "").replace("{{ site.url }}", "");
location = location.replace("//", "/");
location = location.replace(/^\//, "");
if (!location.includes(".")) {
location += ".md";
}
if (!location.includes("_wiki/")) {
location = "_pages/" + location;
}
link.href += location;
wrapper.hidden = false;
}
window.addEventListener("load", (event) => {
let wrapper = document.getElementById("create-link-wrapper");
let link = document.getElementById("create-link");
createLink(wrapper, link);
let name = document.getElementById("page-name");
name.innerHTML = `"${window.location.pathname.split("/").pop().replace(/\.md$/, "")}"`;
});
</script>