You are here:  » Canonical for page 2 onwards of brand/category/merchant pages

Active Forum Topics


Canonical for page 2 onwards of brand/category/merchant pages

Submitted by bat on Fri, 2021-01-15 23:11 in

Hi David,
A few of my category pages (page 2 of results onwards) are being indexed in the search engines and I'd rather they weren't. Please can you help with what code would be required to place a canonical for page 2 onwards of brand/category/merchant result pages so that they point to their respective first page result

e.g. category/widget/21.html has a canonical of category/widget/

Thank you.

Submitted by support on Mon, 2021-01-18 09:31

Hi,

Sure - to add this, edit html/header.php and look for the closing head tag at line 34:

    </head>

...and REPLACE with:

      <?php
        if ((strpos($_SERVER["SCRIPT_FILENAME"],"search.php")!==FALSE) && (isset($parts[1])) && ($page > 1))
        {
          print "<link rel='canonical' href='".tapestry_indexHREF($parts[0],$parts[1])."' />";
        }
      ?>
    </head>

Cheers,
David.
--
PriceTapestry.com