4 ms·
SSR for the purposes of SEO can be achieved in a simpler way, without complicating your whole app to support SSR. Just pre-render the page in headless chromium
by raquo 8y ago
SSR for the purposes of SEO can be achieved in a simpler way, without complicating your whole app to support SSR.
Just pre-render the page in headless chromium / puppeteer when a search engine bot requests it and return the resulting html.
- davidjnelson 8y agoThis is pretty slow though right? Those speed penalties will impact your google search ranking.
- raquo 8y agoI haven't had a chance to try it myself yet, but from what I've read the extra delay is sub 100ms. Caching or pre-rendering the HTML output for bots in advance is an option too depending on the particular use case. I would certainly consider this ahead of SSR driven by "isomorphic" Javascript for frontend-heavy apps.
- jypepin 8y agoreally not sure having a separate way to render your page just for crawlers, using a different rendering engine is "simpler" than having SSR.
- raquo 8y agoSSR is only easy if your frontend is written exclusively in SSR-compatible libraries and your backend is node.js, and even then you need to adjust your frontend code for SSR because node.js doesn't have all the browser APIs that your code could be using (like XHR or the real (not virtual) DOM). On the other hand, puppeteer executes your application in virtually the same environment as the user's browser, without polluting your frontend architecture with SSR concepts and limitations. Yes, you'll need to set up a bit of infra initially. Depending on the use case it may very well pay off.
- pcmaffey 8y agoI pre-render my pages with puppeteer on build, and then hydrate with the js bundles. Everyone gets the faster experience of an HTML page (not just crawlers), while the full js loads async. Example in my profile.