Briannay0917 Posted August 7, 2023 Share Posted August 7, 2023 How do I prevent all the images from my website from showing up in Google Search? Link to comment
Solution Ziggy Posted August 8, 2023 Solution Share Posted August 8, 2023 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment