Skip to content

Commit 3f62c8c

Browse files
committed
Added workaround for github pages
1 parent 477c467 commit 3f62c8c

2 files changed

Lines changed: 54 additions & 1 deletion

File tree

index.html

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,25 @@
44
<meta charset="UTF-8" />
55
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<link rel="stylesheet" href="Eplant/index.css" />
7+
<script type="text/javascript">
8+
// Github pages deployment workaround https://github.com/rafgraph/spa-github-pages
9+
;(function (l) {
10+
if (l.search[1] === '/') {
11+
var decoded = l.search
12+
.slice(1)
13+
.split('&')
14+
.map(function (s) {
15+
return s.replace(/~and~/g, '&')
16+
})
17+
.join('?')
18+
window.history.replaceState(
19+
null,
20+
null,
21+
l.pathname.slice(0, -1) + decoded + l.hash
22+
)
23+
}
24+
})(window.location)
25+
</script>
826
<link
927
rel="stylesheet"
1028
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"

public/404.html

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="robots" content="noindex" />
6+
<title>Redirecting…</title>
7+
<script type="text/javascript">
8+
// Taken from https://github.com/rafgraph/spa-github-pages
9+
// Workaround for Github Pages deployment
10+
var pathSegmentsToKeep = 1
11+
12+
var l = window.location
13+
l.replace(
14+
l.protocol +
15+
'//' +
16+
l.hostname +
17+
(l.port ? ':' + l.port : '') +
18+
l.pathname
19+
.split('/')
20+
.slice(0, 1 + pathSegmentsToKeep)
21+
.join('/') +
22+
'/?/' +
23+
l.pathname
24+
.slice(1)
25+
.split('/')
26+
.slice(pathSegmentsToKeep)
27+
.join('/')
28+
.replace(/&/g, '~and~') +
29+
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
30+
l.hash
31+
)
32+
</script>
33+
</head>
34+
<body></body>
35+
</html>

0 commit comments

Comments
 (0)