We are writing this blog post to answer with more details a common question we get from our customers who bought our module Prestashop SEO Manager. We have described the answer on the frequently asked questions 3 page.
In this Prestashop tutorial, you will learn about how to remove the shop name from the meta title.
We were reluctant to provide a hack mainly because it will impact Prestashop Core code and it requires technical skills from e-merchants when it comes to controllers/classes overriding. Even if we provide a script below to tackle the issue, we will not support any customer later on.
How meta title are generated with Prestashop
A meta title displayed in the frontend of your Prestashop retail point is the aggregation of the meta title field (from either a product record or a category,…) and the name of the shop that is appended to the end. Usually it is redundant as it uses the exact same words as the domain name. For that reason, most of our customers ask to get this removed.
You would need an FTP client like Filezilla together with a text editor application like Notepad++/sublime.
The code hack below was made on Prestashop 184.108.40.206. However it applies to Prestashop 1.5.x.x to Prestashop 1.6.1.x (current version is 220.127.116.11)
Overriding Prestashop Class
We will override the default behaviour of Prestashop and generate a new file in the dedicated override folder.
Prestashop manages the meta fields with the class Meta.php.
Log into your root folder with your FTP application,
Then download the file Meta.php located in classes/Meta.php . After you change it then upload the new version of the file in the folder override/classes/.
Start a new file named Meta.php. This new file will be moved to the override folder and we need to copy only few PHP methods in here.
Edit the class Meta.php from Prestashop. We will modify this file by removing all the references to the script Configuration::get(‘PS_SHOP_NAME’). The impacted methods are:
Let’s start with getHomeMetas. The function on Github (https://github.com/PrestaShop/PrestaShop/blob/18.104.22.168/classes/Meta.php#L232) was changed to the one below:
public static function getHomeMetas($id_lang, $page_name)
$metas = Meta::getMetaByPage($page_name, $id_lang);
$ret['meta_title'] = (isset($metas['title']) && $metas['title']) ? $metas['title']: ' ';
$ret['meta_description'] = (isset($metas['description']) && $metas['description']) ? $metas['description'] : '';
$ret['meta_keywords'] = (isset($metas['keywords']) && $metas['keywords']) ? $metas['keywords'] : '';
This tutorial complements our module SEO Manager. It helps to remove Prestashop shop name from the end of your meta titles. Please refer to our blog post https://www.onasus.com/prestashop-seo-module-faq-part-3/ to find out more. You can download the new file Meta.php here.
We will answer your questions as much as possible. However we will not provide any further support.
[…] Previous […]