2

I am trying to block images from google image search, but for some reason they are not working. I have a Wordpress self-hosted blog and I have full access to the backend. HTML of mydomain.com looks like below:

<a href="mydomain.com/image.png" data-id="4989" rel="nofollow" aria-label="open this media" data-type="image" class="fg-thumb">
  <span class="fg-image-wrap">
    <img width="288" height="384" class="skip-lazy fg-image" role="presentation" data-src-fg="mydomain.com/image_thumbnail.png" src="mydomain.com/image_thumbnail.png" loading="eager">
  </span>
</a>

Google image search using the query site:mydomain.com shows both mydomain.com/image.png and mydomain.com/image_thumbnail.png pointing to mydomain.com. I am trying to remove these image entries from showing up on image search results.

I am aware of Google Search Console removal and it is not a solution I am looking for.

On my NGINX backend, the png files are being served with the header x-robots-tag: noindex. Image files are not being blocked by robots.txt so that the crawlers can see the header, which I think is how it should be done.

So far the above implementation is not working in preventing the images from showing up on Google image search. I have almost ruled out cache issues, because mydomain.com renders dynamically showing random images and new images keep popping up on image search. (UPDATE: It looks like there is a cache issue. I am not using any CDN. After updating mydomain.com to use only a few images, images that are not used still pop up in google image search.)

The page mydomain.com does not have <meta name="robots" content="noindex">, and should not have it because mydomain.com needs to be indexed.

Any help or pointers would be appreciated.

3
  • It takes Google bot a while to recrawl URLs, and then a while to update the index. I think the solution is to use the removal tool to temporarily remove the images (by URLs of the images, rather than the pages containing them), to cover the period of time until Google recrawls them. It might be a good idea to submit an up-to-date sitemap.xml with higher priority to pages with images to help Google crawl everything more efficiently.
    – Uri Raz
    Apr 6, 2023 at 8:33
  • Do you have links to these images on your website pages ? Apr 11, 2023 at 7:44
  • @RohitGupta Yes. The main page has two links in total but they point to random images, dynamically generated each time the page loads. The links are generated with rel="nofollow".
    – cyanite
    Apr 12, 2023 at 9:29

2 Answers 2

0

Google recommends two ways to achieve this goal:

  1. Robots.txt declaration:

    Disallow: /image.png

  2. X-Robots-Tag HTTP header

I would recommend you the X-Robots-Tag HTTP header as the most effective solution.

More information here: Remove images hosted on your site from search results

2
  • The asker states that they are intentionally not using robots.txt to block images, and states that they are already using the X-Robots-Tag HTTP header but it is not working. Apr 6, 2023 at 6:32
  • I am aware of this method but this does not work for some reason.
    – cyanite
    Apr 12, 2023 at 9:31
0

Fixed this. The gallery plugin I was using (Foogallery) was also rendering a javascript portion for pagination. Switching the gallery option to render pagination in HTML resolved this. It looks like Googlebot may have been reading image links from the javascript portion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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