How to Noindex Archive Subpages in Yoast SEO Plugin

How to Noindex Archive Subpages in Yoast SEO Plugin
How to Noindex Archive Subpages in Yoast SEO Plugin

If you are using the amazing Yoast SEO WordPress Plugin, how to noindex archive subpages from tags and categories so they can be blocked from the Google Index. You have probably realised that they no longer block the archive pages from the Google index as they removed the option to nofollow these pages since many years. But why?

Yoast SEO Plugin and NoIndex Options

Yoast SEO WordPress Plugin  is a very popular WordPress plugin used by over 5 million websites. I got alarmed as after shifting from another plugin, my number of Google indexed pages, just zoomed and doubled for no obvious reason till I investigated further.

You can check the number of pages indexed in google by searching for site:domain.com. So as you see we got hundreds of Tags archive subpages indexed in Google. These are all pages with /page/ in URLs.

The explanation which they give on the support page is that Google has got intelligent over the years in recognizing the previous and next rel tags, which signify pagination, and thus, they understand the site architecture very well to send users to the first page. Further to quote …

Noindexing all these pages leads to a lower amount of crawls for them (source), which subsequently leads to lower amounts of crawls for older articles, which is not a good idea on most sites.”

There is emerging info that if you noindex a page, in the long-term then they might not follow links from that page also. Because that page is not indexed, so further crawls may decrease from that page. That seems fine. I personally feel this should be offered as an option which can be tweaked by the users.

How to Noindex Subpages

But I do not want Google to index thousands of pages from tags and categories as it can lead to duplicate content and crawl budget issues on large sites.

So here is the code which I added to functions.php file of my WordPress theme, to block all subpages from categories as well as tags as well as the index archive pages.

add_filter(“wpseo_robots”, function($robots) {

                   if (is_paged()) {

        return ‘noindex,follow’;

    } else {

        return $robots;

    }

});

What this code does is that it will show noindex meta tags on all paged content (is_page) from google. It will add a meta robots tag in the <HEAD> part of the HTML code like this.

<meta name=”robots” content=”noindex, follow>

All URLs with /page/ in the url, which occurs multiple times in index archives. categories archives and tag archives will show this code.

Option 2 – The following code will add noindex to subpages on categories and tags, while sparing subpages of index pages. See what suits you.

add_filter(“wpseo_robots”, function($robots) {

                   if (is_paged() && is_archive()) {

        return ‘noindex,follow’;

    } else {

        return $robots;

    }

});

Very important – Once you activate it, you can check  the HTML source code of all such pages and see the code is displaying correctly and on pages you expected it to. Gradually as Googlebot recrawls you pages and reads these tags, Google will remove from the Index over the next few weeks.

WarningDo this at your own risk as it will remove possibly thousands of indexed pages from the Google Index and may adversely affect your search engine rankings and site traffic. So consult a SEO expert before implementing this code.

Source – https://www.quickonlinetips.com/archives/2020/04/noindex-archive-subpages-yoast-seo-plugin/

RSS Latest Press Release

  • Confort Prestige | Climatisation &amp; Chauffage Announces HVAC Services For Improved Energy Efficiency
    TERREBONNE, QUEBEC- NOVEMBER 14, 2021- Premier heating and cooling company Confort Prestige is excited to share HVAC solutions with domestic customers in the Terrebonne area. These services aim to save customers money on their heating and cooling expenses throughout the year.   Since its debut, Confort Prestige has been committed to customer service. This starts […]
  • Hundreds of Car and Truck Parts Available from Salvage Specialist
    Morganville, NJ – When it comes to finding an auto part for a foreign or domestic vehicle, Trilenium Auto Salvage usually has the answer.   The Morganville, NJ salvage specialist has hundreds, if not thousands, of parts and components at its Tennent Rd premises available.   Trilenium Auto Salvage is one of the busiest salvage specialists […]
  • Flowsent Weed Delivery Offers the Fastest Weed Delivery Service in the Bay Area
    Bay Area, CA - As it becomes easier to get cannabis in different stores and online, weed delivery in Oakland, San Francisco, and other Bay Area cities are becoming more common. People are looking for the easiest way to get their hands on high-quality, safe cannabis, and nothing beats direct to your door.    Many […]
  • Cannamazoo Now Offering the Top Cannabis Concentrates in Michigan
    What are Cannabis Concentrates, Oils, and Extracts?   Kalamazoo, MI - You may be familiar with recreational cannabis in its usual form, but have you ever tried extracts, oils, and concentrates? Each of these forms offers unique effects and benefits that smoking cannabis flowers can't provide. Simple dosing, cleaner effects, and better taste are just […]