Learn what server side rendering is and why it’s preferable to client-side (browser) rendering. You’ll also learn how Gatsby uses server-side rendering to create static websites.
Single-page applications use client-side rendering. All URL requests are redirected to the same bare-bones HTML document, like the example that follows.
- Your bare bones HTML document lacks the keyword, description, and social media metadata (e.g. OpenGraph) necessary for search engine optimization and social media sharing.
Server-side rendering addresses both concerns by creating HTML at run time, when the server receives a browser request). Search engines can index your URLs. Visitors can share them on Facebook or Twitter.
Instead of purely server-side rendering, Gatsby uses the same APIs to create static HTML at build time when you use
gatsby build. Gatsby-rendered HTML pages give you the SEO and social sharing advantages of server-side rendering with the speed and security of a static site generator.