RFC: Support Static views #13
Replies: 2 comments 5 replies
-
What about give a postfix like |
Beta Was this translation helpful? Give feedback.
-
How about making dynamic views explicit? Instead of a file path like Static pages are then simply all pages that do not have a |
Beta Was this translation helpful? Give feedback.
-
Static Views
Views that don’t have an accompanying controller action are considered static views. Static views respond the same every time.
For example, most
/about
pages are static. You can create a static about page by creatingview/about.svelte
with the following:Whenever reasonable, prefer static views over dynamic views. This is because Bud will eventually pre-render these pages and respond with long-term cache headers that can be placed behind a CDN.
Of course views that include client-side Javascript can also be static:
In the example above, when you first visit the page, it will show
Loading...
while firing off a fetch request from the browser. Once the stock data is loaded, it will re-render with the stock price. This is still a static view because the initial page data is the same every time.Beta Was this translation helpful? Give feedback.
All reactions