Skip to content

Commit

Permalink
Refactor 404 page
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanreese committed Sep 14, 2024
1 parent 1b201b1 commit 193ce40
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 81 deletions.
80 changes: 0 additions & 80 deletions assets/404.html

This file was deleted.

2 changes: 1 addition & 1 deletion build/build.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ for pageName, page of pages
html = html.replace /\s*{{page}}/, page.html

# Replace the string {{all}} with links to all pages
html = html.replaceAll "{{all}}", (li "<a href=\"#{p.url}\">#{p.data.title}</a>" for _, p of pages).join "\n"
html = html.replaceAll "{{all}}", (li "<a href=\"#{p.url}\">#{p.data.title}</a>" for _, p of pages when p.data.title not in ["404", "All Pages", "Search", "Future of Coding Wiki"]).join "\n"

# Finally, write the page content to the destination path.
writeFile page.destPath, html
31 changes: 31 additions & 0 deletions pages/404.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: 404
---

<div>
<p>This page doesn't exist.</p>
<a id="new" href="https://github.com/futureofcoding/wiki/new/main/pages?filename=My-file-name.md&value=---%0Atitle:%20A%20New%20Page%0Acontributors:%20Your%20Name%0A---">Create it on GitHub?</a>
</div>

<style>
@media (min-width: 801px) {
title {
display: none
}
article {
display: grid;
place-content: center;
}
article div {
padding: 2em;
margin-left: -12.5em;
border-radius: 1px;
background: #9991;
}
}
</style>

<script>
let name = window.location.pathname.slice(1);
["edit", "new"].forEach((id) => document.getElementById(id).href = `https://github.com/futureofcoding/wiki/new/main/pages?filename=${name}.md&value=---%0Atitle:%20${encodeURI(name)}%0Acontributors:%20Your%20Name%0A---`)
</script>

0 comments on commit 193ce40

Please sign in to comment.