No index, no follow

  • Posts: 320
  • Thank you received: 9
  • Hikashop Business
3 years 3 months ago #339368

Hello.
How can I put in "no index", "no follow" the url of a Hikashop product?

Please Log in or Create an account to join the conversation.

  • Posts: 83777
  • Thank you received: 13561
  • MODERATOR
3 years 3 months ago #339374

Hi,

It's possible. You can edit the file product / show.php via the menu Display>Views
There, you can add such code at the beginning:

<?php
$doc = JFactory::getDocument();
$doc->setMetadata('robots', 'noindex, nofollow');
?>

Please Log in or Create an account to join the conversation.

  • Posts: 320
  • Thank you received: 9
  • Hikashop Business
3 years 3 months ago #339387

Hi.
But that code would affect all products.
I want to be able to use it only on certain products that I don't want to be indexed.
Can this be done?

Please Log in or Create an account to join the conversation.

  • Posts: 83777
  • Thank you received: 13561
  • MODERATOR
3 years 3 months ago #339389

Hi,

Sure.
Create a custom product field with two values 'yes' and 'no', and then change that code to:

<?php
if($this->element->xxx == 'yes') {
$doc = JFactory::getDocument();
$doc->setMetadata('robots', 'noindex, nofollow');
}
?>
where xxx is the column name of that custom product field and the noindex nofollow will be added to the product only if "yes" is selected in the custom field.

Please Log in or Create an account to join the conversation.

Time to create page: 0.058 seconds
Powered by Kunena Forum