Skip to content

Instantly share code, notes, and snippets.

@elisherer
Created November 21, 2024 15:15
Show Gist options
  • Select an option

  • Save elisherer/420810ac48775e86e400258aa8a3a030 to your computer and use it in GitHub Desktop.

Select an option

Save elisherer/420810ac48775e86e400258aa8a3a030 to your computer and use it in GitHub Desktop.

Revisions

  1. elisherer created this gist Nov 21, 2024.
    13 changes: 13 additions & 0 deletions 404.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title>Website</title>
    <!-- client router fix for github pages -->
    <script type="text/javascript">
    location.replace(`${location.origin}?client_redirect=${encodeURIComponent(location.href)}`);
    </script>
    <!-- client router fix for github pages -->
    </head>
    <body>
    </body>
    </html>
    17 changes: 17 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title>Website</title>
    <!-- client router fix for github pages -->
    <script type="text/javascript">
    const cr = new URLSearchParams(location.search).get('client_redirect');
    if (cr) {
    const u = new URL(cr);
    history.replaceState(null, null, u.pathname + u.search + u.hash);
    }
    </script>
    <!-- client router fix for github pages -->
    </head>
    <body>
    </body>
    </html>