2

Today I found an error that appeared in GSC recently.

The URL of the affected page is not a page actually.

That’s a example.com/api/v2/getcurrentuser API call that the JS is requesting to retrieve an active user.

When you go to that URL directly, it says:

{"type":-2,"msg":"You are not logged in"}

Just a blank text on a white screen.

GSC is returning 2 issues for the page:

  1. Viewport not set
  2. Text too small to read

We did not have such an issue a few days ago!

How to fix this? Should we just decline robots?

Gev

2
+50

API endpoints are usually not useful to have in Google Search Results, so the best thing to do would be to block them using robots.txt as you suggested.

These API endpoints are not supposed to be viewed directly by an end-user, so usability issues like "viewpoint not set" and "text too small to read" are nonsensical. I'm not sure how Google decided to try to index these API endpoints. There is no reason for Google to try to crawl them, so block them using robots.txt.

Someone else may suggest using a noindex HTTP header on these endpoints instead of using robots.txt, however that's not quite what we want. A noindex header tells Google "this is a page that we don't want in the search index" whereas a robots.txt disallow tells Google "there isn't any human-readable content at this URL so don't even try to parse it". So robots.txt is a better choice in this situation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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