CorrelAid / correlaid_website

Source code for the CorrelAid website
https://correlaid.org
3 stars 0 forks source link

refactor routes for static build, primarily .js -> server.js #186

Closed KonradUdoHannes closed 12 months ago

KonradUdoHannes commented 1 year ago

Currently the static build is possible under certain conditions, but the static website works extremely poorly. Routes should be refactored to improve upon this. The primary change will be to move data fetching from client side files to server side files (that then get prerendered with the data). This means for instance moving data fetching from +layout.js to +layout.server.js

Its possible that other modifications have to be made to get the static site fully functioning. And this issue should be used to document these requirements. The task can then possibly be done as sub issues.

How to build the static site

KonradUdoHannes commented 1 year ago

Part of #100

jstet commented 1 year ago

I moved the membership application to a dump folder temporarily as this is not a prio right now 37ea5c4

jstet commented 1 year ago

with "works extremely poorly", do you mean that one only gets file not found errors etc.?

jstet commented 1 year ago

renamed files in b9c320a

jstet commented 1 year ago

I think the proper way to test the static build is by running

npm run preview

I tested deploying the static website here: https://correlaid-test.onrender.com/

jstet commented 1 year ago

There is a pattern behind what is not working currently:

layout.server.js only seems to work on the german home ssr for podcast, blog, events collections etc. works

Maybe this is connected to the way layout.svelte works. It seems to render only the slot most of the time and not the other components. This also explains the wrong layout for pages like: https://correlaid-test.onrender.com/blog/

KonradUdoHannes commented 1 year ago

Made some improvements here with #197, which fixed prerendering of blogpost routes, and #198 which made path lookup for data rendering agnostic wrt. the trailingSlash configuration. This seems to fix most if not all the issues, at least there were no apparent issues to me at the moment.

@jstet If you find more issues with the static site please post them here as well. If we don't find anything directly, we should consider closing this issue and treating potential later issues separately.

jstet commented 12 months ago

The static site seems to work now doesnt it? Can we close this issue?

KonradUdoHannes commented 12 months ago

Probably. I basically wanted to leave it open until the end of today or tomorrow to see whether anything major comes up from other people that are testing/having a look. If nobody stumbles upon anything immediately, I'll close this issue and treat future bugs as separate issues.

KonradUdoHannes commented 12 months ago

As no major issues came up this is considered done, and future bugs will be treated as separate issues.