Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search

How do I prevent Google from indexing archive, category, and tag pages?


Recommended Posts

Site URL: https://www.cottoncashmerecathair.com/

I have discovered via search console that Google is indexing my archive pages, categories, and tags over individual blog posts, which means my site is not showing up in search results when it should be. How can I tell Google not to index those pages and instead index the blog posts? I read in other posts here that you can inject code, but how do I inject code for pages that aren't in my navigation? I also know about canonical links but they confuse me; is that something I do in search console? How does one go about setting those? Any insight/tips would be much appreciated!

Link to comment
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

I don't know for sure if the following will work and it requires the business plan or above.

It may not work as we have no control over how Google indexes pages. We can only suggest that pages not be indexed. Weather this works depends on if Google runs this Javascript before it indexes the page. My reading suggests that Google may but again. We can't control what Google does.

Add the following to Settings > Advanced > Code Injection > HEADER.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

Add the following to Blog Settings > Advanced > Page Header Code Injection for the blog page.

<script>

  $( ( ) => {
  
    /*
    
      add meta noindex tag to blog non-detail pages
      
      Version       : 0.1d0
      
      SS Version    : 7.0
      
      Templates     : Montauk ( Julia, Kent, Om )
                      
                      your template is not listed? then it is not currently
                      supported
      
      Dependancies  : jQuery
      
      By            : Thomas Creedon < http://www.tomsWeb.consulting/ >
      
      no user serviceable parts below
      
      */
      
    // bail if not blog page
    
    if ( ! $( 'body[class~="collection-type-blog"]' ).length ) return;
    
    if ( $( 'body[id^="item-"]' ).length ) return; // bail if detail
    
    $( '<meta content="noindex" name="robots">' ).appendTo ( 'head' );
    
    } );
    
  </script>

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

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...