Skip to content

Latest commit

 

History

History
75 lines (65 loc) · 2.59 KB

404.md

File metadata and controls

75 lines (65 loc) · 2.59 KB
title
404

404

Will there be 404 pages in the future?

  • {{ site.data.files | map: "fileName" }}
    <script> // futureofcoding.org/issues -> https://github.com/stevekrouse/futureofcoding.org/issues // futureofcoding.org/issues/3 -> #3 const path = window.location.pathname .split("/") .slice(1) // get rid of the leading "" if (path.length > 0) { if (path[0] == "issues") { window.location.replace("https://github.com/stevekrouse/futureofcoding.org/" + path.join("/")) } } const moved = { '/essays/app-idea': '/drafts/app-idea', '/essays/causal': '/drafts/casual', '/essays/casual': '/drafts/casual', '/essays/customer-support': '/drafts/customer-support', '/essays/invented-or-discovered': '/drafts/invented-or-discovered', '/essays/learnable-programming': '/drafts/learnable-programming', '/essays/legal-code': '/drafts/legal-code', '/essays/power': '/drafts/power', '/essays/regex-for-humans': '/drafts/regex-for-humans', '/essays/visual': '/drafts/visual', '/drafts/frp': '/papers/comprehensible-frp', '/notes/conal-elliot': '/notes/conal-elliott' } const movedKey = Object.keys(moved).find(url => window.location.pathname.includes(url)) movedKey && window.location.replace(moved[movedKey]) // futureofcoding.org/epsiodes/1 --> futureofcoding.org/epsiodes/001 const episodeNumberMatch = /\/episodes\/(\d+)/.exec(window.location.pathname) const episodeNumber = episodeNumberMatch && episodeNumberMatch[1] if (episodeNumber) { window.location.replace(`/episodes/${episodeNumber.padStart(3, '0')}`) } const sf = (a, b) => { const aInt = parseInt(a.split("-")[0]) const bInt = parseInt(b.split("-")[0]) if (!isNaN(aInt) && !isNaN(bInt)) { return aInt - bInt; } else { return a.localeCompare(b) } } const endingSlash = window.location.pathname.endsWith("/") ? "" : "/" const pathname = window.location.pathname + endingSlash const files = document.getElementById('fileElement').innerText.split(".").filter(path => path.startsWith(pathname)).map(path => path.replace(pathname, "")).sort(sf) if (files.length) { window.title = pathname document.getElementById('notFoundText').style.display = "none" document.getElementById('directory').style.display = "block" document.getElementById('title').innerText = pathname files.forEach(file => { document.getElementById('directory').innerHTML += '
  • ' + file + '
  • ' }) } </script>