1

I was recently (for about half year) creating REST API based web pages for my client. Mostly using:

  • node.js,
  • express.js,
  • react,
  • mongodb,
  • etc.,

but suddenly client decided that he don't want REST API based websites any more because all of them are not so much optimized for web search engines and he cannot find them as easily as the old "traditionally created" websites. Previously I was using Zend Framework or Word-press.

RESTFul apps are so much popular nowadays that I think I must do something wrong.

The architecture of my applications looks like this:

  1. User loads the web app in the browser.
  2. User requests to open list of items - let's say for example list of books.
  3. The front end loads the data using REST API (taking the JSON) and displays the data in container.
  4. User clicks on the item/book.
  5. Front end takes the JSON data from REST API and displays it in container.

So the front end and the REST API back end are completely separate things living their own life. Is that correct approach?

I noticed that the application, for example created in ReactJS has almost nothing in the source in web browser, all the code generation is embeded in js script. Can that have an impact on the SEO? Below example code.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="theme-color" content="#000000">
    <!--
      manifest.json provides metadata used when your web app is added to the
      homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
    -->
    <link rel="manifest" href="/manifest.json">
    <link rel="shortcut icon" href="/favicon.ico">
    <!--
      ...
    -->
    <title>React App</title>
  </head>
  <body>
    <noscript>
      You need to enable JavaScript to run this app.
    </noscript>
    <div id="root"></div>
    <!--
      This HTML file is a template.
      If you open it directly in the browser, you will see an empty page.
      ...
    -->
  <script type="text/javascript" src="/static/js/bundle.js"></script></body>
</html>

Is there any way to make REST API based webs better for SEO? Or eventually are there any good practices which I should follow to make rest apps SEO friendly?

  • 1
    Even though you haven't mentioned it I know what you mean, this question is more specific to server side js frameworks than general api consumption. Have a look at this npmjs.com/package/express-seo – Abu Nooh Dec 28 '17 at 12:01
  • You may want to look into having server side rendering. The problem is that in (many?) cases, the empty page is all the search engine is going to see. So having single page loads returning the server side rendering is perfect for search engines. reactjs.org/docs/react-dom-server.html – Alexis Wilke Feb 20 at 21:40
0

The backend implementation of a website has no bearing on SEO. Crawlers visit websites like any user. Don't worry about the server software, frameworks, etc. Concentrate on user experience, which actually matters.

  • 1
    Although op hasn't mentioned it, server side js doesn't provide static content it creates content per visit using js and lots of bots aren't able to crawl it because of its front end scripting nature. – Abu Nooh Dec 28 '17 at 12:05
  • @Abu That's not a generalisation one can make, my website is server side JS (Node.js) and generates static content. Furthermore, Google has deprecated its AJAX crawling scheme because "Google should be able to discover your AJAX website and render the pages fine". – grg Dec 28 '17 at 12:12
  • 1
    Yes perhaps Google can however there are lots of other bots which won't be able to. – Abu Nooh Dec 28 '17 at 12:59
0

Hmm Api have nothing to do with SEO . Api is used to pull data from server and display on website.

Only thing that may have some(minor) impact on SEO , can be a longer site loading time (waiting for api response ) - but not in all cases (depends of how you are loading data from API ( synchronous/asynchronous ) .

But basiclly api have nothing to do with seo

Not the answer you're looking for? Browse other questions tagged or ask your own question.