Skip to content

Latest commit

 

History

History
87 lines (78 loc) · 3.1 KB

File metadata and controls

87 lines (78 loc) · 3.1 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 -> futureofcoding#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', '/drafts/dctp': '/essays/dctp', '/slack-link': 'https://join.slack.com/t/futureofcoding/shared_invite/enQtNjk1NDc2MTkzNjE4LWFjYTY2NDU1ODI1MTI5M2MwYjZlZTk4OTU5NTM1YTRiMDEwODZhN2Y3OWNhN2VmZDU4YmJiZjlhYTFjYmJhZGQ', '/slack-readme': '/community', '/slack': '/community' } const movedKeyExact = Object.keys(moved).find(url => window.location.pathname === url) if (movedKeyExact) { window.location.replace(moved[movedKeyExact]) } else { const movedKey = Object.keys(moved).find(url => window.location.pathname.includes(url)) if (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>