Jump to content

Meta Tag Duplication in pages is almost Solved, any help?


Recommended Posts

Hi, guys a long time i'm looking for a solution to this problem.

Google webmaster tool show me duplicate meta tag on my category or best-sales pages, like this:

 

URL/11-category-name

URL/11-category-name?p=1

URL/11-category-name?p=2

 

I read on this site how to fix it CLICK

 

Open /classes/Tools.php and replace the function completeMetaTags (around line #500) with the function below.

 

static public function completeMetaTags($metaTags, $defaultValue)

{

global $cookie;

$no_duplication = "";

if (self::getValue('p'))

$no_duplication .= ($no_duplication != ""?" #":"#").self::getValue('p');

if ($no_duplication != "")

$no_duplication = " (".$no_duplication.")";

if ($metaTags['meta_title'] == NULL)

$metaTags['meta_title'] = Configuration::get('PS_SHOP_NAME').' - '.$defaultValue;

$metaTags['meta_title'] .= $no_duplication;

if ($metaTags['meta_description'] == NULL)

$metaTags['meta_description'] = (Configuration::get('PS_META_DESCRIPTION', intval($cookie->id_lang)) ? Configuration::get('PS_META_DESCRIPTION', intval($cookie->id_lang)) : '');

$metaTags['meta_description'] .= $no_duplication;

if ($metaTags['meta_keywords'] == NULL)

$metaTags['meta_keywords'] = Configuration::get('PS_META_KEYWORDS', intval($cookie->id_lang)) ? Configuration::get('PS_META_KEYWORDS', intval($cookie->id_lang)) : '';

return $metaTags;

}

 

Open /classes/Tools.php and replace the function getHomeMetaTags (around line #490) with the function below.

 

static public function getHomeMetaTags($id_lang)

{

global $cookie, $page_name;

 

/* Metas-tags */

$metas = Meta::getMetaByPage($page_name, $id_lang);

$ret['meta_title'] = (isset($metas['title']) AND $metas['title']) ? Configuration::get('PS_SHOP_NAME').' - '.$metas['title'] : Configuration::get('PS_SHOP_NAME');

$ret['meta_description'] = (isset($metas['description']) AND $metas['description']) ? $metas['description'] : '';

$ret['meta_keywords'] = (isset($metas['keywords']) AND $metas['keywords']) ? $metas['keywords'] : '';

$no_duplication = "";

if (self::getValue('p'))

$no_duplication .= ($no_duplication != ""?" #":"#").self::getValue('p');

if ($no_duplication != "")

{

$ret['meta_title'] .= " (".$no_duplication.")";

$ret['meta_description'] .= " (".$no_duplication.")";

}

return $ret;

}

 

This correction solve double meta tag on pages, but open new problem - i lose my meta tags and meta description on pages like: best-sales, price-drop etc.

 

Please help a colleague. i search for man who understands the source code and want help me for solving this problem.

 

P.S. sorry for my poor language

 

Regard Dim

Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...