⬆️ ⬇️

React and SEO: how to make friends?

As you know, search engine optimization of single-page applications is not an easy task and its solution may require significant labor costs, special skills from developers and financial costs from the customer. What solutions does the community propose to, as quickly as possible and at minimal cost, make the React website search engine friendly?



Some banal about SEO



About 92% of traffic comes from the first page of search engine results , and 75% of traffic comes from the first five websites.

Google occupies more than 90% of the search engine market .

Search Engine Optimization (SEO) is the process of structuring and organizing a site in order to increase the volume and improve the quality of its traffic by increasing its position and frequency in search engine results, focusing on keywords that reveal the specifics of the site.

The main goal of the SEO process is to improve the visibility of a website on the Internet and increase website traffic.



The work of search engines is based on the relentless caching of website content. Due to the fact that the process is automated, it is very important that the content be structured and formatted in a manner understood by the machine. The SEO process includes optimizing the website's performance, reworking its content in order to increase the relevance of the content to keywords, as well as providing the site with tools that help search robots understand it.



This may seem fairly simple, but in the case of sites built on React, this is not always the case.



React and SEO



SPA in brief



A one-page application or SPA is a web application or website that interacts with the user by dynamically changing the current pages, rather than downloading new pages from the server. SPA work quickly, because most resources (HTML + CSS + Scripts) are downloaded only once during the entire period of their life. The application receives and gives only data.

One example of technology that can be used to create a SPA is ReactJS , a library that is well optimized to run on user browsers ( more here. )



SPA's main problems with SEO



SPA is, in fact, a JavaScript program running in a browser, and if a search web bot cannot execute scripts, it will not be able to get a properly rendered page and index it.

In October 2015, Google made an important announcement that its bots would run JS files on websites if they were allowed to do so. And, although this statement sounds very positive, and its search bots themselves become more sophisticated, relying on their ability to execute JavaScript is risky . Google bot can refuse to perform javascript for a variety of reasons ( read more here ):





Other search engine bots such as Yahoo, Bing, Baidu, and others do not support JavaScript and see the SPA pages empty.



For these reasons, you have to look for ways to render the SPA site on the server side in order to give guaranteed bots the opportunity to see their contents in the correct form.



Solutions SEO problems for SPA websites



There are two main ways to solve SEO problems facing SPA websites:



  1. Isomorphic (universal) SPA;
  2. Pre-rendering.


Additional SEO Improvements for React Web Sites:





How isomorphic React helps with SEO?



Isomorphic React site automatically determines if JavaScript is disabled on the client side. If JavaScript is disabled, the script is executed on the server and the result (static HTML + CSS) is sent to the client. In this case, all the attributes and content necessary for SEO are present during the download.

If JavaScript is enabled, an isomorphic React site in the simplest case can be loaded in the usual way, when everything is rendered in the browser, or cleverly : partial rendering is performed on the server side, which means that only the first DOM rendering is done on the server, and all subsequent ones are produced directly in browser. In other words, the browser receives the fully rendered initial DOM and JavaScript, and when the state of the application changes, it is responsible for all subsequent updates.



It is believed that an isomorphic solution is the best method for solving SEO problems of SPA web applications, but unfortunately, unfortunately, similar solutions for React SPA, at the moment, are difficult to implement :





')

Source: https://habr.com/ru/post/418619/



All Articles