You are here:  » Modify meta tag decription in category and brand pages

Support Forum



Modify meta tag decription in category and brand pages

Submitted by drBas on Sun, 2009-11-01 22:02 in

Hi David,

I would like to modify the meta tag description of the category an brand pages. In the serach.php i now have the code:

$header["meta"]["description"] = "some text ".htmlentities(str_replace("category:","categorie: ",$q),ENT_QUOTES,$config_charset)." some text";

In the category pages the word "category:" changes to "categorie: ".
In the brandpages I want the word "brand:" to change to "merk: ".

Any idea?
Thank you.

Submitted by support on Mon, 2009-11-02 08:00

Hi,

You could do it like this, using arrays as the parameters to str_replace():

$header["meta"]["description"] = "some text ".htmlentities(str_replace(array("category:","brand:"),array("categorie: ","merk: "),$q),ENT_QUOTES,$config_charset)." some text";

Hope this helps!

Cheers,
David.

Submitted by magnaromagna on Wed, 2010-01-20 20:50

Hello,
now in product.php I'm using this:

$header["title"] = htmlentities($q,ENT_QUOTES,$config_charset)." - ".htmlentities($product["products"][0]["category"],ENT_QUOTES,$config_charset);
$header["meta"]["description"] = htmlentities($description,ENT_QUOTES,$config_charset);

Is it possible to add the category too in the meta description?

Thanks!

Submitted by support on Thu, 2010-01-21 09:28

Hi,

Sure - to append it afterwards (after a SPACE), have a go with:

$header["meta"]["description"] = htmlentities($description,ENT_QUOTES,$config_charset)." ".$product["products"][0]["category"];

Cheers,
David.

Submitted by magnaromagna on Thu, 2010-01-21 12:24

and to add it at the beginning of the description?
Thanks again :-)

Submitted by support on Thu, 2010-01-21 13:46

Hi,

Give it a go like this...

$header["meta"]["description"] =
  $product["products"][0]["category"]." ".htmlentities($description,ENT_QUOTES,$config_charset);

Cheers,
David.