On demand prerendering with SvelteKit #2997
Replies: 2 comments
-
Just thinking - "At first request" seems to be a specific case of "triggered pre-render": Another example of an event where you might want to trigger a fresh prerendering is "When certain data in a CMS changes". So I could see a generic API for prerendering being very useful as well. Or does something like that already exist / is an implementation of my example already possible? (Apart from the obvious possibility to re-build on such CMS changes) |
Beta Was this translation helpful? Give feedback.
-
You might be interested in this #661 |
Beta Was this translation helpful? Give feedback.
-
Overview
Hello everyone!
SvelteKit offers developers the choice of:
How can SvelteKit perform prerendering on demand?
In other words, how can a request for a route:
Motivation
Some advantages of this approach:
These advantages are more pronounced in sites with many static pages.
Related
Gatsby's DSG
Gatsby v4 came with the ability to use Deferred Static Generation (DSG).
A page rendered in DSG mode is built when the first user requests for it.
It is then cached and served to requests made by all users.
Netlify's DPR
Netlify announced Distributed Persistent Rendering earlier this year.
With DPR, pages can be built on demand using appropriate Netlify functions and redirects.
Conclusion
This approach of building pages only when they are required seems to fit the vision of #transitionalapps.
Although it might not have a huge impact on smaller websites, it can improve both the Dev and User experience of large-scale sites.
Any feedback is greatly appreciated!
Thank you for your time!
Beta Was this translation helpful? Give feedback.
All reactions