Skip to content

Commit

Permalink
GitHub Pages single-page apps HOTFIX: 404.html, index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
chunhochow committed Jul 27, 2023
1 parent 8553860 commit 9529dc9
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 47 deletions.
57 changes: 57 additions & 0 deletions 404.html
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<!--
HOTFIX for single-page applications (SPA) on GitHub Pages:
keep 404.html as an exact copy of index.html
-->
<html lang="en">
<head>
<meta charset="utf-8" />
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
<meta content="text/html; charset=utf-8" />
<meta
content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"
name="viewport"
/>

<link rel="icon" href="/images/SW_favicon.png" />

<link href="/css/font-awesome-5.7.1.css" rel="stylesheet" />
<link href="/images/SW_favicon.png" rel="icon" type="image/png" />

<!-- descriptive things -->
<title>SimWrapper</title>
<meta content="SimWrapper" name="twitter:title" />
<meta content="SimWrapper" name="og:title" />
<meta content="From the VSP team at TU-Berlin" name="twitter:description" />
<meta content="From the VSP team at TU-Berlin" name="og:description" />
<meta content="https://vsp.berlin/simwrapper" name="og:url" />
<!-- <meta
content="https://github.com/matsim-vsp/covid-sim/raw/master/src/assets/images/v1-thumb.png"
name="og:image"
/> -->
<meta content="summary_large_image" name="twitter:card" />
<meta content="@billyinberlin" name="twitter:site" />
<meta content="@billyinberlin" name="twitter:creator" />
<!-- <meta
content="https://github.com/matsim-vsp/covid-sim/raw/master/src/assets/images/v1-thumb.png"
name="twitter:image"
/> -->

<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,700;1,400;1,700&family=Roboto+Slab:ital,wght@0,400;0,700;1,300&display=swap"
rel="stylesheet"
/>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
<noscript>
<strong>
This advanced browser-based application requires JavaScript to function. Please enable it to
continue.
</strong>
</noscript>
</body>
</html>
25 changes: 0 additions & 25 deletions index.html
Expand Up @@ -33,31 +33,6 @@
name="twitter:image"
/> -->

<!-- github pages hack: allows single-page-app to handle arbitrary URLs -->
<script>
function getQueryVariableForRedirect(variable) {
var query = window.location.search.substring(1)
var vars = query.split('&')
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=')
if (pair[0] == variable) {
return pair[1]
}
}
return false
}

;(function () {
let numRedirect = getQueryVariableForRedirect('redirect404')
var redirect = localStorage[`redirect${numRedirect}`]
delete localStorage[`redirect${numRedirect}`]

if (redirect && redirect != location.href) {
history.replaceState(null, null, redirect)
}
})()
</script>

<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
Expand Down
22 changes: 0 additions & 22 deletions public/404.html

This file was deleted.

0 comments on commit 9529dc9

Please sign in to comment.