Created
October 19, 2024 11:58
-
-
Save zettadam/c9db37f0dabe85821fc7ef0d1a13b93b to your computer and use it in GitHub Desktop.
Static pages in a Solid single-page app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // @solidjs/router; redirect to a static URL defined somewhere in a web server configuration | |
| <Route path="/me" component={() => { | |
| onMount(() => { | |
| window.location.href = "https://thispage.is/about-me" | |
| }) | |
| return null | |
| }} /> | |
| // Nginx config; point to static files on a disk. | |
| server { | |
| location /me { | |
| root /path/to/site-static-pages; | |
| try_files $uri $uri/ /me.html; | |
| } | |
| location / { | |
| root /path/to/site; | |
| try_files $uri $uri/ /index.html; | |
| } | |
| } | |
| // @solidjs/router; somewhere in your app component | |
| <A href="/me">@ me</A> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment