Jump to content

[SOLVED] How to call category name in meta.php


Recommended Posts

Can someone please provide the proper syntax for replacing PS_SHOP_NAME with the current category name?

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

Thank You for any replies

Link to comment
Share on other sites

The whole idea behind this started with removing the PS_SHOP_NAME that Prestashop adds to the end of all <title> meta tags.

It is not necessary and takes away from SEO keywords.  DH42 had a good tutorial on how to remove this but what I wanted to do was take it a step further and add the category name instead for certain pages (i.e. product, category, etc) I "THINK" can control where this happens by only changing this for the section I wish to change in meta.php

 

For instance, if I add the category name to the product pages, it will add a relevant keyword to the title tag. I always leave the title blank in the BO so that it pulls the name of the product.

 

What are your thoughts Vekia?

Link to comment
Share on other sites

take a look, i changed header.tpl file located in theme directory

<title>
        {if $category}
        {$meta_title|escape:'html':'UTF-8'|replace:Configuration::get('PS_SHOP_NAME'):$category->name}
        {else}
        {$meta_title|escape:'html':'UTF-8'|replace:Configuration::get('PS_SHOP_NAME'):''}
        {/if}
        </title>

code above will remove shop name from <meta> title from each page in your store.

and if you will browse categories - it will add category name instead :)

 

no core modifications ;)

based on my guide available here: remove shop name from meta title

  • Like 1
Link to comment
Share on other sites

Perfect! Thank you Vekia - always so helpful!

 

Now if I can just get Prestashop to show product availability date on the product page (which currently it does not)  -_-  - the product pages should be very user friendly.

 

Thank you kindly!

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

  • 6 months later...

hi vekia 

thank you for all your topics - it been very helpful 

 

i have a problem :

i want , that if the META TITLE is not null - the theme will take only the meta title

but if the meta title is null - then it work like you postd.

 

how can i do it ? 

Link to comment
Share on other sites

hi vekia 


thank you for all your topics - it been very helpful 


 


i have a problem :


i want , that if the META TITLE is not null - the theme will take only the meta title


but if the meta title is null - then it work like you postd.


 


how can i do it ? 


 

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