Jump to content

(SOLVED) Change homepage and product page title?


Recommended Posts

You can edit the product page title on the "1. Info." tab of the product editor. Click the "Click here to improve product's rank in search engines (SEO)" link (above the short description), then enter the page title in the "Meta title" field.

Go to Preferences > Meta-Tags, then edit "index.php" to enter a meta-title for the homepage.

There is no option in PrestaShop to remove the shop name from the meta-title. You will have to manually edit classes/Tools.php to do that. Search for and delete the following code:

.' - '.Configuration::get('PS_SHOP_NAME')

  • Like 2
Link to comment
Share on other sites

It's the following code on lines 471-485 (in PrestaShop v1.3.2):

/* Products specifics meta tags */
if ($id_product = self::getValue('id_product'))
{
   $row = Db::getInstance()->getRow('
   SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description_short`
   FROM `'._DB_PREFIX_.'product` p 
   LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product`) 
   WHERE pl.id_lang = '.intval($id_lang).' AND pl.id_product = '.intval($id_product).' AND p.active = 1');
   if ($row)
   {
       if (empty($row['meta_description']))
           $row['meta_description'] = strip_tags($row['description_short']);
       return self::completeMetaTags($row, $row['name']);
   }
}



which calls the completeMetaTags function:

static public function completeMetaTags($metaTags, $defaultValue)
{
   global $cookie;

   if ($metaTags['meta_title'] == NULL)
       $metaTags['meta_title'] = $defaultValue.' - '.Configuration::get('PS_SHOP_NAME');
   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)) : '';
   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;
}



So try changing removing the shop name on the sixth line above.

Link to comment
Share on other sites

  • 1 month later...

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...