Jump to content

Change title tag on tag page


sorinmarius

Recommended Posts

Hi,

I have a big question that has been on my mind since forever. I gave tags to every product in my store. When I click on the tag from my tag module in the sidebar, every tag page has the same "title tag". How can I change the title on the Tag Page from "Search" to the tags name?

 

Please Help!

 

Thanks.

Link to comment
Share on other sites

  • 8 months later...

I am also looking for a solution for this, I use the tags for organice my products.

It will be great if just can print the query text in the title tag of a search results page, but in SEO configuration I can't write parameters or variables.

 

I'm using PS 1.5.0.17.

Link to comment
Share on other sites

  • 4 months later...
  • 4 months later...
  • 2 years later...

in pre v1.6, i added this code, it works well:

 

classes/Meta.php
Find the getMetaTags function
 
add the code between "add by ruby"
--------------------------------------------
 
public static function getMetaTags($id_lang, $page_name, $title = '')
    {
        if (!(!Configuration::get('PS_SHOP_ENABLE')
            && !in_array(Tools::getRemoteAddr(), explode(',', Configuration::get('PS_MAINTENANCE_IP'))))) {
            if ($page_name == 'product' && ($id_product = Tools::getValue('id_product'))) {
                return Meta::getProductMetas($id_product, $id_lang, $page_name);
            } elseif ($page_name == 'category' && ($id_category = Tools::getValue('id_category'))) {
                return Meta::getCategoryMetas($id_category, $id_lang, $page_name, $title);
            } elseif ($page_name == 'manufacturer' && ($id_manufacturer = Tools::getValue('id_manufacturer'))) {
                return Meta::getManufacturerMetas($id_manufacturer, $id_lang, $page_name);
            } elseif ($page_name == 'supplier' && ($id_supplier = Tools::getValue('id_supplier'))) {
                return Meta::getSupplierMetas($id_supplier, $id_lang, $page_name);
            } elseif ($page_name == 'cms' && ($id_cms = Tools::getValue('id_cms'))) {
                return Meta::getCmsMetas($id_cms, $id_lang, $page_name);
            } elseif ($page_name == 'cms' && ($id_cms_category = Tools::getValue('id_cms_category'))) {
                return Meta::getCmsCategoryMetas($id_cms_category, $id_lang, $page_name);
            }
 
//add by ruby
 
elseif ($page_name == 'search')
{
if ($placeholder = Tools::getValue('search_query'))
{
$the_title = 'Results for matching "'.$placeholder.'" ~~ '.Configuration::get('PS_SHOP_NAME');
$srt['meta_description'] = 'The result is '.$placeholder." from ".Configuration::get('PS_SHOP_NAME');
}
else if ($placeholder = Tools::getValue('tag'))
{
$the_title = 'Tagged with "'.$placeholder.'" ~~ '.Configuration::get('PS_SHOP_NAME');
$srt['meta_description'] = 'The result is '.$placeholder." from ".Configuration::get('PS_SHOP_NAME');
}
else
{
  $the_title = 'Product Search  ~~ '.Configuration::get('PS_SHOP_NAME');
  $srt['meta_description'] = 'The result is '.$placeholder." from ".Configuration::get('PS_SHOP_NAME');
}
$srt['meta_title'] = $the_title;
 
return $srt;
}
 
// end add by ruby
 
        }
 
        return Meta::getHomeMetas($id_lang, $page_name);
    }
Link to comment
Share on other sites

  • 3 years later...
  • 2 weeks 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...