How to Prevent Search Engine Indexing of StaticImage in Gatsby / React?

51 views Asked by At

I'm seeking a solution to exclude specific StaticImages from being indexed by search engines, especially when used for icons.

I'm using Gatsby and including images through StaticImages, like this:

<StaticImage src="../img/stopcrawl/notforgoogle.jpg" />

Unfortunately, I can't find a method (e.g., in the documentation) to prevent search engines from indexing these images.

Excluding the image folder via the robots.txt file doesn't work because during gatsby build the images from the src folder are not transferred to the same folder structure in the public directory. Instead, all images end up in the static subfolder within the public directory, scattered and without a clear structure.

While I can prevent entire pages from being indexed, I specifically want to exclude images on certain pages from being indexed. Any suggestions on how to achieve this would be greatly appreciated.

0

There are 0 answers