Performance issues at scale
babichjacob opened this issue · comments
Right now, this template is set up to load all blog posts' metadata and contents at once into the browser's memory:
sveltekit-mdsvex-blog/src/routes/posts/__layout.svelte
Lines 4 to 12 in 4cde064
This can be avoided by doing the same work in an endpoint instead: https://github.com/babichjacob/university-website/blob/84b5e7ff44550910550a3c809ccb9f1402df301b/src/routes/blog/index.json.ts#L6-L23
and fetching from that in the layout (or wherever it's needed, like to show the most recent 3 posts on the website's homepage and all posts on the website's /blog
route): https://github.com/babichjacob/university-website/blob/84b5e7ff44550910550a3c809ccb9f1402df301b/src/routes/blog/index.svelte#L3
Thanks for opening this! That makes sense. I can go ahead and make this change.
@babichjacob I went ahead and merged #3 which addresses this, just let me know if there's anything I missed. Thanks!