'Google Indexing + Yoast SEO Media Attachments

I have ~300 pages on my website so when I saw my index on Google Search Console, I knew something was wrong. I believe I suffered from the Yoast SEO bug on WordPress (updating from an old version of 7.0) where it created attachment pages for all media that have now been indexed.

I am trying to remove the extra 400+ pages that are now /attachment/ urls and lead to 404's. So far I turned off media attachment url's in yoast.

What is the best approach to removing all of these from my index? Is there any way for Google to do another bulk crawl so I don't have to manually remove all 400+ urls?

Any insight will be great.

enter image description here



Solution 1:[1]

As you can read from the official Yoast blog here: Yoast Blog they recommend you use the index purge plugin to remove to attachment URL's.

Solution 2:[2]

Click on the "search appearance" category. Then click on "media"

  • Redirect attachment URLs to the attachment itself? => no
  • Show Media in search results? => off

I think you should not redirect attachment to the parent blog for a reason. The attachment page isn't an equivalent of the parent page. I think it gets stuch in the google index. Consequently, the best solution is to noindex the attachment pages to delete the content of these pages in the Google directory.

Once i have added all my attachment pages to a sitemap. I go the following error: enter image description here

This means that for google, the attachment URLs were duplicate of parent pages. This was due to the default Yoast redirection behavior. Therefore, it is better to noindex them. Maybe these redirections can be considered as cloaking by google.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gertjan Brouwer
Solution 2 Nicolas Guérinet