How to properly do nofollow and dofollow for indexing collection pages

How to properly do nofollow and dofollow for indexing collection pages

DinoBena
New Member
4 0 0

Hello, my site is www.chipchasehr.com

I noticed when inspecting any page that I can find nofollow and google is currently not indexing properly my collections.

I want to do dofollow for the first pages of collections, and no follow for the rest of the pages.

I searched for the solution but I can't find it, all the solutions says install an app and pay for it and I know that it can be done with the little bit of coding, can someone help?

Replies 4 (4)
DinoBena
New Member
4 0 0

GSC indexed most of the pages but not correctly I think, and there was a lot of duplicated content indexed.

DinoBena
New Member
4 0 0

Also I have a problem with canonical tags, there is a lot another pages with the corresponding canonical mark

DinoBena
New Member
4 0 0

Can you write here the solution for it so other users with same problem can use it as a solution?

webzetoone
Visitor
1 0 0

 

To achieve a "dofollow" for the first pages of collections and "nofollow" for the rest, you can modify the head section of your collection template file. If you're using Shopify, this can be done in the collection.liquid file, usually found in the "Sections" or "Templates" folder of your theme.

Here's a simple code snippet to add to your collection.liquid file that checks the page number and sets the meta robots tag accordingly:

Step-by-Step Solution

  1. Go to your Shopify theme editor:

    • Online Store > Themes > Actions > Edit Code
  2. Open the collection.liquid template:

    • Look for the collection.liquid file in the "Sections" or "Templates" folder.
  3. Add the following code to the <head> section:

 

liquid
 
{% if paginate.current_page == 1 %} <!-- Allow indexing for the first page --> <meta name="robots" content="index, follow"> {% else %} <!-- Set nofollow for all other pages --> <meta name="robots" content="noindex, nofollow"> {% endif %}
 

Explanation

  • paginate.current_page: This checks the current page number.
  • The meta tag will allow "index, follow" on the first page of your collection, and "noindex, nofollow" for subsequent pages.

Additional Considerations

  • Make sure to save and test the changes.
  • Use Google Search Console to check if your pages are being indexed correctly.

This solution does not require any additional apps or paid tools, and it should help with your indexing issue.
I have done the same for webzeto.com and the issue was resolved by applying said technique.