Problem
User searches for "OpenZeppelin AccessControl" on Google, and they open this URL:
https://docs.openzeppelin.com/contracts/2.x/access-control
Which contains the documentation for the 2.x contracts, which are not the most up-to-date. As of posting this issue, the latest version is 5.x.
There's no warning or anything in the docs.
Toggle to see screenshot
Solution
Example Sitemap
The sitemap tells Google: "Hey, this is the up-to-date version—crawl and rank this". This alone won't de-index the old pages, but it increases the chances that the new ones take precedence.
<url>
<loc>https://docs.openzeppelin.com/contracts/5.x</loc>
<lastmod>2025-03-01</lastmod>
</url>
<url>
<loc>https://docs.openzeppelin.com/contracts/4.x</loc>
<lastmod>2024-06-01</lastmod>
</url>