Jump to content

Place page title before site name


Recommended Posts

How can I place the name of site before the page title? Currently, it’s like this: [Page title] – [My site.com]. I’m looking for a way to make it look like this: [My site.com] – [Page title]. I would like to implement this change to all pages on my site not just the front page.

Link to comment
Share on other sites

Just like what you see in the attachment. I’m looking for a way to place “PrestaShop Forums” before “Place title before site name.” So the final result would look like this PrestaShop Forums – Place title before site name – Mozilla Firefox.

post-318174-0-13241300-1326844583_thumb.jpeg

Link to comment
Share on other sites

You will need to update classes/tools.php to do this. Upon review of the code, you will need to change code in several different places. You may want to post in the modules sections of the forum to see if anyone has developed a module to do this. For example there are modules that do this for joomla.

 

here is a link to a previous inquiry for similar subject as yours.

Link to comment
Share on other sites

  • 10 months later...

these changes worked for me (v.1.5.2):

 

/classes/Meta.php:

 

line 217:

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

 

to:

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

 

 

line 276:

$row['meta_title'] = $title.$row['meta_title'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME');

 

to:

$row['meta_title'] = Configuration::get('PS_SHOP_NAME').' - '.$title.$row['meta_title'].(!empty($page_number) ? ' ('.$page_number.')' : '');

 

 

line 278:

$row['meta_title'] = $row['name'].(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME');

 

to:

$row['meta_title'] = Configuration::get('PS_SHOP_NAME').' - '.$row['name'].(!empty($page_number) ? ' ('.$page_number.')' : '');

 

 

line 281:

$row['meta_title'] = $title.(!empty($page_number) ? ' ('.$page_number.')' : '').' - '.Configuration::get('PS_SHOP_NAME');

 

to:

$row['meta_title'] = Configuration::get('PS_SHOP_NAME').' - '.$title.(!empty($page_number) ? ' ('.$page_number.')' : '');

 

 

lines 310-311:

$row['meta_title'] = ($row['meta_title'] ? $row['meta_title'] : $row['name']).(!empty($page_number) ? ' ('.$page_number.')' : '');
$row['meta_title'] .= ' - '.Configuration::get('PS_SHOP_NAME');

 

to:

$row['meta_title'] = Configuration::get('PS_SHOP_NAME');
$row['meta_title'] .= ' - '.($row['meta_title'] ? $row['meta_title'] : $row['name']).(!empty($page_number) ? ' ('.$page_number.')' : '');

 

 

line 339:

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

 

to:

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

 

 

line 363:

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

 

to:

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

 

 

line 387:

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

 

to:

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

 

 

line 403:

$meta_tags['meta_title'] = $default_value.' - '.Configuration::get('PS_SHOP_NAME');

 

to:

$meta_tags['meta_title'] = Configuration::get('PS_SHOP_NAME').' - '.$default_value;

Edited by idofri (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...