Skip to content

Instantly share code, notes, and snippets.

@zettadam
Created October 19, 2024 11:58
Show Gist options
  • Select an option

  • Save zettadam/c9db37f0dabe85821fc7ef0d1a13b93b to your computer and use it in GitHub Desktop.

Select an option

Save zettadam/c9db37f0dabe85821fc7ef0d1a13b93b to your computer and use it in GitHub Desktop.
Static pages in a Solid single-page app
// @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