VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: hotrod on December 09, 2023, 04:45:27 AM

Title: How to Block Google from Indexing Print Page...
Post by: hotrod on December 09, 2023, 04:45:27 AM
I'm not showing the print icon and have that turned off.. But I'm seeing some of my products are indexed by the print page..
/shop-now/compressor-abpn83304783-detail?tmpl=component&print=1

What would be the line I put into the robot.text...
Title: Re: How to Block Google from Indexing Print Page...
Post by: Jumbo! on December 11, 2023, 18:53:04 PM
It can not done using robots.txt

You can ask the robots not to index these pages by adding the following codes to your template's component.php file. i.e., templates/YOUR-TEMPLATE-FOLDER/component.php

<?php
JFactory
::getDocument()->setMetaData('robots''NOINDEX, NOFOLLOW, NOARCHIVE, NOSNIPPET');
?>


OR

<?php
if (JFactory::getApplication()->input->getInt('print'0)) {
    
JFactory::getDocument()->setMetaData('robots''NOINDEX, NOFOLLOW, NOARCHIVE, NOSNIPPET');
}
?>
Title: Re: How to Block Google from Indexing Print Page...
Post by: hotrod on December 12, 2023, 16:55:06 PM
Thank you...
Title: Re: How to Block Google from Indexing Print Page...
Post by: sirius on December 13, 2023, 10:42:18 AM
mmmm

Disallow: /*&print=1

works ok in robots.txt
but agree that it just block the access, and google need to access to know IF it must index it or not.