Skip to content

Commit 90534aa

Browse files
authored
Tentanto um hask para o roteamento funcionar no github pages
1 parent f58c73c commit 90534aa

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

404.html

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
6+
<title>SeraphyBR's Blog</title>
7+
8+
<script>
9+
sessionStorage.redirect = location.href;
10+
</script>
11+
12+
<meta http-equiv="refresh" content="0;URL='/'" />
13+
</head>
14+
15+
<body>
16+
A little hack to make SPA routing "work" in github pages
17+
</body>
18+
</html>

index.html

+12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
/>
2424

2525
<link data-trunk rel="copy-dir" href="public/img" />
26+
<link data-trunk rel="copy-file" href="404.html" />
2627

2728
<!-- include support for `wasm-bindgen --weak-refs` - see: https://rustwasm.github.io/docs/wasm-bindgen/reference/weak-references.html -->
2829
<link data-trunk rel="rust" data-wasm-opt="z" data-weak-refs />
@@ -42,6 +43,17 @@
4243
/>
4344

4445
<title>SeraphyBR's Blog</title>
46+
47+
<!--Github Page 404 Hack for SPA routing-->
48+
<script>
49+
(function () {
50+
var redirect = sessionStorage.redirect;
51+
delete sessionStorage.redirect;
52+
if (redirect && redirect != location.href) {
53+
history.replaceState(null, null, redirect);
54+
}
55+
})();
56+
</script>
4557
</head>
4658
<body
4759
class="tw-vflex tw-bg-no-repeat tw-bg-cover tw-bg-center tw-bg-fixed tw-bg-gray-800 tw-bg-forest-stairs"

0 commit comments

Comments
 (0)