Hi all, does Kobweb support SSR and rehydration on...
# kobweb
j
Hi all, does Kobweb support SSR and rehydration on the client? If not, are there plans for this? Thanks!
d
Kobweb does not support SSR nor has any current plans; but it does have an export process, so when you visit a Kobweb site you pull down what is essentially the final HTML for that page.
👍 1
You also might be interested in following along what https://github.com/rjaros/kilua is doing. They have SSR as a core feature.
There's also https://github.com/kwebio/kweb-core although recently they were looking for a new maintainer.
s
In other words, Kobweb offers static site generation which already solves most of the concerns. however, if you strictly need SSR for SEO purposes, e.g. because you need crawlers to index data which is not known at build time (SSG), you can (ab)use the export functionality and manipulate the html before serving it. during the export you would use some placeholder strings which you later replace with the actual data on the server. So it's not actually SSR like assembling the html dom on the server but rather simple templating. this is definitely more of a hack but if it's a constraint for you than this could be a potential solution
rehydration, however, is a bit more tricky. I also embed the templated data as a json structure into the dom and parse it on the client, to use this instead of an additional api call. if you really decide to do this, let me know - I can share some code. because there are a few pitfalls to this.
👏 1
thank you color 1
all that being said, SSG is usually to be preferred if the data is known at build time. it's more efficient and way easier to do
👍 1
j
Thank you for the responses everyone.