I think that Haskell offers fantastic features. Also suited for Web development. However, one feature I miss. Server-side rendering. The reasons are Google indexing crawlers and pre-rendering to increase performance on mobile devices.
Is it possible to server-side render Haskell frontend with Ghcjs, Haste, Elm or with some other Haskell->JS compiler?
I don't believe that Alexandr has answered the question.
The question is whether Haskell web frameworks do server-side rendering of JavaScript -- vanilla JS or JS-via-Haskell (GHCJS, Fay, etc.). My understanding is that Yesod does not pre-render JS (i.e., execute the JS and serve the resulting HTML). Rather, Yesod does server-side generation of HTML via hamlet (or blaze-html, or lucid, depending on your preferences).
The only library that I could find for Haskell server-side JS rendering (for Angular) is:
https://github.com/danchoi/ngrender
But it's still in beta.
If there are other libraries/solutions, I'd love to hear about them. This is a problem for me as well. I want to use purescript-halogen on the client, but... SEO.
Edit: For now, the best option might be to use nginx as your load-balancer in front of your Haskell server with prerender.io to supply rendered JS-pages to search bots:
https://github.com/prerender/prerender
https://gist.github.com/thoop/8165802
Stock Yesod scaffold does server-side rendering of HTML and has custom pre-processed languages for HTML, CSS and JS. You should be able to integrate Fay/Purescript without too much of a problem given that they've been around for a while and yesod comes with scaffolds for at least one of them.
For something like GHCJS integration, you'll see a lot of progress being done in upcoming versions of the stack
tool (e.g. this issue). That will theoretically make full-stack Haskell achievable without too much of a hassle. Right now, it's my understanding that integrating GHCJS is non-trivial.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With