Here's a very basic start to doing canonical URL handling:
IT IS NOT RECOMMENDED TO ADD THIS TO AN ALREADY-INDEXED SITE WITHOUT FIRST CAREFULLY CONSIDERING THE CONSEQUENCES OF DOING SO!!!!
1. At the bottom of init_category_path.php (replacing the ?> if any), add this:2. In /includes/templates/YOUR_TEMPLATE_FOLDERNAME/common/html_header.phpCode:// CANONICAL HANDLING: // product pages: if (strstr($current_page, '_info') && isset($_GET['products_id'])) { $canonicalLink = zen_href_link($current_page, 'cPath=' . zen_get_generated_category_path_rev(zen_get_products_category_id($_GET['products_id'])) . '&products_id=' . $_GET['products_id']); } // category/prod-listing pages: if ($current_page == 'index' && isset($_GET['cPath'])) { $excludeParams = array('zenid', 'action', 'main_page', 'language', 'currency', 'typefilter', 'disp_order', 'page', 'sort', 'alpha_filter_id', 'filter_id'); $canonicalLink = zen_href_link($current_page, zen_get_all_get_params($excludeParams)); }
Add the 3 lines highlighted here, as shown:There are some who may argue that the 'sort' or 'page' options should be removed from these exclusions. If you feel similarly, you're welcome to change it.Code:<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER . DIR_WS_HTTPS_CATALOG : HTTP_SERVER . DIR_WS_CATALOG ); ?>" /> <?php if (isset($canonicalLink) && $canonicalLink != '') { ?> <link rel="canonical" href="<?php echo $canonicalLink; ?>" /> <?php } ?> <?php /** * load all template-specific stylesheets, named like "style*.css", alphabetically




