Zen Cart Logo
Forums / General Questions / Remove category name from meta

Remove category name from meta

Views: 934

Results 1 to 7 of 7
18 Apr 2013, 3:57 AM
#1
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Remove category name from meta

How do I remove and prevent auto generation of **Category **names from <meta name="keywords" and <meta name="description"?

18 Apr 2013, 4:04 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Remove category name from meta

Reprogram the PHP code in /includes/modules/YOUR_TEMPLATE_NAME/meta_tags.php
(if you don't have such a file, copy it from /includes/modules/meta_tags.php and make your modifications, saving them into your override folder as described above)

18 Apr 2013, 4:10 AM
#3
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Remove category name from meta

DrByte:

Reprogram the PHP code in /includes/modules/YOUR_TEMPLATE_NAME/meta_tags.php
(if you don't have such a file, copy it from /includes/modules/meta_tags.php and make your modifications, saving them into your override folder as described above)

I was just looking at that file in my override. I couldn't figure were they were getting generated? Where should I be looking at?

19 Apr 2013, 5:40 PM
#4
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Remove category name from meta

DrByte:

Reprogram the PHP code in /includes/modules/YOUR_TEMPLATE_NAME/meta_tags.php
(if you don't have such a file, copy it from /includes/modules/meta_tags.php and make your modifications, saving them into your override folder as described above)

// Get all top category names for use with web site keywords
$sql = "select cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = 0 and c.categories_id = cd.categories_id and cd.language_id='" . (int)$_SESSION['languages_id'] . "' and c.categories_status=1";
$keywords_metatags = $db->Execute($sql);
while (!$keywords_metatags->EOF) {
$keywords_string_metatags .= zen_clean_html($keywords_metatags->fields['categories_name']) . METATAGS_DIVIDER;
$keywords_metatags->MoveNext();
}
define('KEYWORDS', str_replace('"','',zen_clean_html($keywords_string_metatags) . CUSTOM_KEYWORDS));

The above code on line 29 of **/includes/modules/YOUR_TEMPLATE_NAME/meta_tags.php ** effects the Meta tag <meta name="keywords" content=" " /> and <meta name="description" content=" " />. But I can't figure out what to modify, to eliminate the top category name from appearing in the meta tags.:blush:

19 Apr 2013, 6:49 PM
#5
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Remove category name from meta

I removed the Top Category names from <meta name="keywords" content=" " /> and <meta name="description" content=" " />

by replacing:

$keywords_string_metatags .= METATAGS_DIVIDER;

With:

$keywords_string_metatags .= zen_clean_html($keywords_metatags->fields['categories_name']) . METATAGS_DIVIDER;

from /includes/modules/MyTEMPLATE/meta_tags.php at around line 29 .

19 Apr 2013, 7:38 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Remove category name from meta

I think you wrote that backwards.

But even simpler would be to simply comment-out these lines:```
$keywords_metatags = $db->Execute($sql);
while (!$keywords_metatags->EOF) {
$keywords_string_metatags .= zen_clean_html($keywords_metatags->fields['categories_name']) . METATAGS_DIVIDER;
$keywords_metatags->MoveNext();
}

19 Apr 2013, 7:52 PM
#7
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Remove category name from meta

You are correct.

Unfortunately, I can't edit my last post anymore.