Jump to content

(page title – site name) tomerg3 code --> Prevent Meta Tag Duplication


Recommended Posts

How can I switch this code to (page title – site name)

Ps Version 1.3.1.1

Open /classes/Tools.php

 

static public function completeMetaTags($metaTags, $defaultValue)
   {
       global $cookie;
       $no_duplication = "";
       if (self::getValue('orderby'))
           $no_duplication .= self::getValue('orderby')." ".self::getValue('orderway');  
       if (self::getValue('p'))
           $no_duplication .= ($no_duplication != ""?" #":"#").self::getValue('p');
   if (self::getValue('n'))
       $no_duplication .= ($no_duplication != ""?" ":"").self::getValue('n');
       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;
   } 





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('orderby'))
           $no_duplication .= self::getValue('orderby')." ".self::getValue('orderway');  
       if (self::getValue('p'))
           $no_duplication .= ($no_duplication != ""?" #":"#").self::getValue('p');
       if (self::getValue('n'))
       $no_duplication .= ($no_duplication != ""?" ":"").self::getValue('n');
       if ($no_duplication != "")
       {
           $ret['meta_title'] .= " (".$no_duplication.")";
           $ret['meta_description'] .= " (".$no_duplication.")";
       }
          return $ret;
   } 



http://www.presto-changeo.com/content/6-prestashopseotips


Thanks for rolling with a brother! lol I heard Elliot say that a lot on dc101

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...