-
Notifications
You must be signed in to change notification settings - Fork 66
Add support for getStaticProps and getServerSideProps #7
Comments
Hey @laugharn, Thank you for taking the time to file an issue! I'm going to look into this in the coming days. I had a busy week, so I haven't been able to do so just yet. I'll get back to you soon — hopefully with some insights 😁 PS: I'm going to tag #1 and @Yagogc who had a related issue, I think:
We didn't find a solution in that thread, I'm just tagging it for future reference. |
Copy pre-rendered pages with SSG to Netlify publish directory and copy SSG page JSON data to _next/data/ directory. See: #7
Copy pre-rendered, dynamically routed pages with SSG to Netlify publish directory and copy SSG page JSON data to _next/data/ directory. Makes sure that the page source is not treated as an SSR page. Otherwise, a Netlify Function would be created and they page would have a (server-side-rendered) fallback. See: #7
Copy pre-rendered, dynamically routed pages with SSG to Netlify publish directory and copy SSG page JSON data to _next/data/ directory. Create a Netlify Function to handle the paths not defined in the page's getStaticPaths. When requesting a page that has not been pre-rendered, it will be SSRed by this function. The function also returns the page data for paths that have not been pre-defined. See: #7
For pages that use getServerSideProps, we create a Netlify Function just like we do for pages with getInitialProps. In addition, we also add an extra redirect that allows getting the page props as JSON. This is when navigating to the page on the client-side. See: #7
Hey @laugharn, Happy to report that The code is already committed to the I'm hoping to merge it into master later today and finally publish Cheers, Reference: For pages with
For pages with
|
- **Breaking: You must change your `netlify.toml` configuration for next-on-netlify v2.0.0.** Please look at the README for the latest configuration. `next-on-netlify` now builds pre-rendered pages and static assets in `out_publish`. Netlify Functions for SSR pages are built to `out_functions`. - Add support for `getStaticProps` (#7) - Add support for `getStaticPaths` with and without fallback (#7) - Add support for `getServerSideProps` (#7) - Query string parameters are now correctly passed to Next Pages and API endpoints (#9) - Response headers are now correctly set (#9) - When a user encounters a 404, `next-on-netlify` now display the NextJS 404 page rather than Netlify's default 404 page. You can customize the NextJS 404 page. (#2) - Every page with server-side rendering is now converted to a stand-alone Netlify Function. Previously, all SSR pages were bundled in a single Netlify Function. - `next-on-netlify` now prints out which pages are being converted to Netlify Functions for SSR, which pages are served as pre-rendered HTML, and the redirects that are being generated. - Adding custom redirects via a `_redirects` file in the project root is no longer supported. Let me know if you want this back. Or define your redirects in `netlify.toml`.
Hey @laugharn, Thank you for testing! 😁
Thank you for your support and beta testing! Don't forget to switch back to Let me know if you run into any trouble. And if you end up building something awesome, let me know, too! I'd love to feature some real-world projects in the README. Happy hacking! 🔥 |
PS: I'm going to close this issue for now. But feel free to reopen any time or file a new issue, when something new comes up!! :) |
Are there any plans to change the Fallback behavior and cache the results of SSR? |
Feature request
Full support for the Next 9.3 getStaticProps/getServerSideProps page functions
Is your feature request related to a problem? Please describe.
I recently started deploying a site using next-on-netlify (thank you so much for this plugin, you have saved my team a ton of heartache) and would like to take advantage of getStaticProps, so we can statically generate some content from our CMS at build time.
As you can see above, the resources aren't getting generated for the new page types. The pages still load, and has the data generated with SSR, but it's generating the page on demand and not statically at build.
Describe the solution you'd like
Generate pages with getStaticProps as static. Would be happy to help, but am not sure where to start looking.
Describe alternatives you've considered
Accept the outcome but remove the 404 errors by using getInitialProps instead
The text was updated successfully, but these errors were encountered: