How we can set the list of products urls to **no-index no-follow** those products are canonical


Go to the your_theme/template/page/html/head.phtml

add a condition

if(Mage::app()->getFrontController()->getAction()->getFullActionName()=='catalog_product_view') {
    $_product = Mage::registry('current_product');
        <meta name="robots" content="NOINDEX,FOLLOW" />

Where $_product->getCanonical() would be the attribute that you should assign to the products where no index nofollow required

  • Actually i have a csv in which a list of urls given these urls are of product with category or without category in between,in short we need to no index no follow the urls that are here.how is this possible? – Charul Tyagi Feb 7 '19 at 6:28
  • I would recommend to create a custom database table and a cutom model for your list of urls and implement the suggested approach from Shoaib checking against that model – HelgeB Feb 7 '19 at 9:04
  • create a new attribute canonial with "Yes/No" values, its default value should be "No". Now from your csv, assign "Yes" to all the products. Then use my code, it will work – Shoaib Munir Feb 7 '19 at 9:23
  • Note: Your CSV should contain sku so that it would update through profiler – Shoaib Munir Feb 7 '19 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.