-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving sub routes #19
Comments
Found another possible solution to my situation: generating all links in the app with trailing slashes: Then react-snapshot generates folders with index.html files in them and "serve" serves them as expected: /index.html |
Oh interesting! What webserver were you using on the rendered output? I think it just needs to automatically try appending |
@geelen I am using |
@gleen |
@AndreyNikiforov @geelen
I'm curious what most hosts do regarding path resolution — for example, if I were to use react-snapshot to prerender my routes and throw the static site up on gh-pages or netlify or any other static host, would I get the folder of I think the idea of zero-configuration prerendering is absolutely awesome, just curious about whether the way nested folders are handled would lead to unexpected behavior. |
@AndreyNikiforov @geelen I am having a similar issue trying to serve static html for subroutes. Root route |
I 'm using create react app, and it seems like route document is being served from the service worker. Could this be the issue? |
Thanks for a very nice library, @geelen . I am learning how I can use it with my brand new create-react-app test site and noticing behavior that I do not understand. I would appreciate your help explaining.
I created the following site structure (urls):
snapshot output:
? Starting crawling http://localhost:2999
?? Saving / as /index.html
?? Saving /shop as /shop.html
?? Saving /shop/pizza as /shop/pizza.html
?? Saving /shop/pizza/margherita as /shop/pizza/margherita.html
I run "serve build" and navigate to different urls using Chrome. Here is observed behavior:
What is the best approach to handle sub routes? May be I am missing http server config that should handle file layout produced by react-snapshot (other than always serving 200.html for all requests)?
One solution is for every url always produce folder and index.html inside (assuming http server always serves index.html as default doc for folders). My structure will look like:
/index.html
/shop/index.html
/shop/pizza/index.html
/shop/pizza/margherita/index.html
Thanks,
Andrey
The text was updated successfully, but these errors were encountered: