Jump to content
sorinmarius

Change title tag on tag page

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Works really great! Now I only have to change the h1-tag on the page ass well....

Share this post


Link to post
Share on other sites

Works really great! Now I only have to change the h1-tag on the page ass well....

Hi, can you please tell us where to insert to this code ? does it works well on 1.6 ?

thank you

Share this post


Link to post
Share on other sites

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);
    }

Share this post


Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More