You are here:  » noindex, follow for paged search results

Support Forum



noindex, follow for paged search results

Submitted by gunarbod on Fri, 2011-07-15 13:03 in

Hi David,

first of all thanks for your great support here in the forum and prior buying Price Tapestry. Now a new user, I have a question regarding meta tags:

I would like to have

<META NAME=”ROBOTS” CONTENT=”NOINDEX,FOLLOW”>

on all paged search results, paged category-, merchant- and brand-pages (e.g. 2nd, 3rd 4th page), whenever a filter is applied (e.g. &merchantFilter=, &categoryFilter=) and on all product-pages as well.

All the other pages should have "index, follow" instead.

What would be the best way to do this? Would be great if you could help me out!

Thanks in advance!
Gunar

Submitted by support on Fri, 2011-07-15 13:36

Hello Gunar,

No problem - taking search.php first, look for the following code at line 350:

  require("html/header.php");

...and REPLACE With:

  if (($page > 1) || ($priceWhere != ""))
  {
    $header["meta"]["ROBOTS"] = "NOINDEX,FOLLOW";
  }
  else
  {
    $header["meta"]["ROBOTS"] = "INDEX,FOLLOW";
  }
  require("html/header.php");

($priceWhere can be used to identify whether any filters - min / mæxPrice, category etc. have been applied)

For products.php, look for the following code at line 108:

  require("html/header.php");

...and REPLACE with:

  $header["meta"]["ROBOTS"] = "NOINDEX,FOLLOW";
  require("html/header.php");

Cheers,
David.
--
PriceTapestry.com

Submitted by gunarbod on Fri, 2011-07-15 13:49

Works perfect!

Thanks,
Gunar

Submitted by Bakalinge on Fri, 2013-02-08 09:11

Hi David,

This hack is very interesting, but is there a way to avoid brand pages to get this "NOINDEX,FOLLOW" ?

Thanks !
Bak

Submitted by support on Fri, 2013-02-08 09:20

Hello Bak,

Sure - as the replacement in search.php have a go with;

  if ( (($page > 1) || ($priceWhere != "")) && ($parts[0]<>"brand") )
  {
    $header["meta"]["ROBOTS"] = "NOINDEX,FOLLOW";
  }
  else
  {
    $header["meta"]["ROBOTS"] = "INDEX,FOLLOW";
  }
  require("html/header.php");

Cheers,
David.
--
PriceTapestry.com

Submitted by Bakalinge on Fri, 2013-02-08 10:23

Thanks David !

Submitted by Bakalinge on Sat, 2013-05-18 15:19

Hello David,

After 2 months of tests, I think this method is not quite effective because categories (especially those I created manually) are invisible in SERP and I doubt that the "juice" is transmitted to product pages. But it is important for Google to understand that categories pages are hierarchical pages as it hates indexing paginated pages.

In the same time, I think it's important to keep tagging "NOINDEX, NOFOLLOW" search results pages.

So, to resume, is it possible for /brand /category /merchant pages to :

- include <META NAME=”ROBOTS” CONTENT=”INDEX,FOLLOW”>
- include a pagination tag with rel="next" and rel="prev" ( see http://goo.gl/EM2zD )

for /search pages, to keep <META NAME=”ROBOTS” CONTENT=”NOINDEX,FOLLOW”>

Thanks in advance David !
Bak

Submitted by support on Sat, 2013-05-18 18:32

Hello Bak,

Sure - firstly, to add support for a new header variable $header["links"] edit html/header.php, look for the closing </head> at line 17:

</head>

...and REPLACE with:

<?php if (isset($header["links"])): foreach($header["links"] as $link): ?>
<link rel='<?php print $link["rel"]; ?>' href='<?php print $link["href"]; ?>' />
<?php endforeach; endif; ?>
</head>

Then, in place of the above modifications to search.php, look for the following code around line 350:

  require("html/header.php");

...and REPLACE with:

  if ($rewrite)
  {
    $totalPages = ceil($navigation["resultCount"] / $config_resultsPerPage);
    $baseHREF = $_SERVER["REQUEST_URI"];
    if ($page > 1)
    {
      $baseHREF = str_replace($page.".html","",$baseHREF);
    }
    if ($page < $totalPages)
    {
      $header["links"][] = array("rel"=>"next","href"=>$baseHREF.($page+1).".html");
    }
    if ($page == 2)
    {
      $header["links"][] = array("rel"=>"prev","href"=>$baseHREF);
    }
    elseif ($page > 2)
    {
      $header["links"][] = array("rel"=>"prev","href"=>$baseHREF.($page-1).".html");
    }
    $header["meta"]["robots"] = "index,follow";
  }
  else
  {
    $header["meta"]["robots"] = "noindex,nofollow";
  }

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Bakalinge on Sat, 2013-05-18 20:41

Thank you David, it works like a charm !