Jump to content

How do I prevent all the images from my website from showing up in Google Search?

Go to solution Solved by Ziggy,

Recommended Posts

  • Replies 1
  • Views 831
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Solution

You want to add a "noindex" tag to every image, you can try this script that will should do that for you, add to header code injection:

  <script>
    // Get all image elements on the page
    const images = document.getElementsByTagName('img');

    // Loop through each image and add a meta tag with noindex to each one
    for (let i = 0; i < images.length; i++) {
      const image = images[i];

      // Create the meta tag
      const metaTag = document.createElement('meta');
      metaTag.setAttribute('name', 'robots');
      metaTag.setAttribute('content', 'noindex');

      // Append the meta tag to the image
      image.parentNode.insertBefore(metaTag, image);
    }
  </script>

 

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

📈 SEO Space (Referral link)
Ⓜ️ 
Will Myers' Plugins & Tutorials (Referral link)
 🔌 Ghost Squarespace Plugins (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲SQSP Themes (Referral link) 
Spark Plugin (Referral link) 
 🖼️Pinch-to-Zoom Gallery Lightbox Plugin (Referral link) 

 Did I help? Buy me a coffee?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.