Skip to content

Commit a4a3928

Browse files
authored
Bugfix/404 index.html (#39)
1 parent 8890bda commit a4a3928

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

public/index.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@
2727
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-197700032-1"></script>
2828
<script>
2929
// GitHub Pages での SPA アドレス解決用
30-
(function(){
31-
const query = window.location.search;
32-
if (query.startsWith('?p=')) {
33-
const route = decodeURIComponent(query.substr(3));
34-
window.history.replaceState(null, null, route);
30+
(function(l) {
31+
if (l.search[1] === '/' ) {
32+
var decoded = l.search.slice(1).split('&').map(function(s) {
33+
return s.replace(/~and~/g, '&')
34+
}).join('?');
35+
window.history.replaceState(null, null,
36+
l.pathname.slice(0, -1) + decoded + l.hash
37+
);
3538
}
36-
})();
39+
}(window.location))
3740

3841
</script>
3942
<script>

0 commit comments

Comments
 (0)