react-relay-example icon indicating copy to clipboard operation
react-relay-example copied to clipboard

SSR streaming HTML, for SEO?

Open redbar0n opened this issue 2 years ago • 3 comments

Any chance you'd want to update this example with SSR and streaming HTML?

So it will work well for regular sites that want SEO?

Currently Google's cached version of the page is empty (as it is a pure SPA): http://webcache.googleusercontent.com/search?q=cache:https://quotes.juffalow.com/

The other people who've done something towards this end, is:

  • Gabriel / zth (but in ReScript): https://x.com/zth/status/1503758833260417028?s=20

  • Vincent (gif of intriguing demo): https://x.com/vincentriemer/status/1461177900586049536?s=20

  • XiNiHa : https://github.com/XiNiHa/vilay (using https://vike.dev (previously called vite-plugin-ssr) with Vite for the SSR part). According to my talk with him on Discord, he archived the repo because of facing some issues with bundling (maybe the error that usePageContext() not able to find the provided context, likely because of re-wrapping Vike's exports as a separate package, if he recalls correctly), and due to not needing SSR for prod any more (he was making an admin dashboard). Note that Vike's V1 design is soon upcoming (should be stable/finalized), track progress here: https://github.com/vikejs/vike/issues/578 and progress with the docs here: https://github.com/vikejs/vike/pull/1206

redbar0n avatar Oct 30 '23 16:10 redbar0n

I have one ongoing project with Next.js so maybe I can try to use it also here 🤔

juffalow avatar Oct 30 '23 17:10 juffalow

Yeah, but I think NextJS only partially supports Relay. https://vike.dev/nextjs-comparison

That’s why a lot of people using Relay have been using Vite + Vike which should have a more straightforward integration (and you’d have more control): https://vike.dev/relay

redbar0n avatar Oct 30 '23 17:10 redbar0n

FWIW, I found that tobias-tengler recently made nextjs-relay-streaming-ssr which uses Next.js 14 App Router (and even React 18 streaming SSR). It has a pretty solid explanation on how it works.

redbar0n avatar Dec 21 '23 23:12 redbar0n