Disable Automatic Filling of Meta Description Tag

Just found that the cart automatically grabs content of the products pages and puts it in Meta Description tag. How to disable it and leave it blank?



Also, by default, there are no words containing 3 or less characters in meta description content. It looks especially ridiculous if the product is e.g. U2 CD or DVD.



I tried to edit meta.tpl file and changed:







to:







or







but there is no change. Any advice?!

Hi guys,



this is still on. I checked it on 2.2.4 and it still cuts out words under 3 letters.



I found something on core/fn.common.php about line 3030 or 3124 (depending your version)



it goes like



function fn_generate_meta_description($html, $max_words = 60)



Under that there's an if with this inside



if (fn_strlen($v) > 3) {
$meta[] = $v;
}




This indicates what should happen with words under 3 letters, took it away but still getting the same results.



Any Ideas how to fix that?

Did you make sure to clear cache?

yes i did, maybe it saves those values in the db.



I will check this out .



-----------------------------------------------------------------------



Well its not in the db but I changed the value 3 to 0 instead of removing the whole “if” and it worked Fine!!!



I have now automated meta descriptions the right way.



Please Cs-Cart support fix that in the new version. If there should be a limit for words smaller than 3 words, it should be in the meta keywords, which they are not automated in cs-cart anyway…



Meta Description is a major Seo factor, and when people forget to put meta descriptions they get horrible meta descsriptions from the system



Fotis

[quote name='dvsgr' timestamp='1332076924' post='133356']

yes i did, maybe it saves those values in the db.



I will check this out .



-----------------------------------------------------------------------



Well its not in the db but I changed the value 3 to 0 instead of removing the whole “if” and it worked Fine!!!



I have now automated meta descriptions the right way.



Please Cs-Cart support fix that in the new version. If there should be a limit for words smaller than 3 words, it should be in the meta keywords, which they are not automated in cs-cart anyway…



Meta Description is a major Seo factor, and when people forget to put meta descriptions they get horrible meta descsriptions from the system



Fotis

[/quote]



Thanks for this! Awesome!

Hi ,

I also post that in Bug Tracker.



It is under review.

I don't think they take this issue seriously because the problem was still there even after upgrading to 2.2.5. It is actually a annoying issue for me. The automaticly generated meta descriptions make lots of duplicated descriptions which can be shown on Google Webmaster tools. It's simply because some of the items are very similar except only several characters differences. For example: Seagate 2TB internal hard drive vs. Seagate 3TB internal hard drive. The CS-Cart cut off 2TB and 3TB for both items which make google think the meta descriptions are the same. Google may simply discard these items.



The second issue for automatic meta descriptions are the double quote “”“. Google will cut off the meta descriptions if it found double quote characters inside the description. Indeed, it's easy to overcome the issue. Replace '”' with '"' will get the problem fixed.



Lastly, I personally deem that we should keep the characters '.' and ','.



CS-Cart Engineers, please fix them in the future releases if possible. Thanks!

Why not use the Meta Description and Meta keyword fields of the product. Nobody can automate this to fit everybody's desire. Either hand enter, very time consuming, or pump everything into excel and write up a little calulation customize the text in each of these fields.

I had to update 2 core files to make it so the meta tags wouldn't get auto-generated if they weren't filled out. Not the best way since they are core files but didn't see any other way to do it.



/core/fn.common.php ~ line 2340

/controllers/customer/products.php ~ line 84



In fn.common.php I had to modify this function “fn_generate_meta_description” to have it return false instead of generating a description based of the product description.



function fn_generate_meta_description($html, $max_words = 60)
{
// Disable this function to auto-generate the meta_description
return false;
}




In products.php I disabled a fallback else statement that would generate the description and keywords based off the products category if the product had empty values for meta description or keywords.



if (!empty($product['meta_description']) || !empty($product['meta_keywords'])) {
$view->assign('meta_description', $product['meta_description']);
$view->assign('meta_keywords', $product['meta_keywords']);
}
// Disable auto-fill meta tags
// else {
// $meta_tags = db_get_row("SELECT meta_description, meta_keywords FROM ?:category_descriptions WHERE category_id = ?i AND lang_code = ?s", $_SESSION['current_category_id'], CART_LANGUAGE);
// if (!empty($meta_tags)) {
// $view->assign('meta_description', $meta_tags['meta_description']);
// $view->assign('meta_keywords', $meta_tags['meta_keywords']);
// }
// }




Also modified the meta.tpl file.

/skins/basic/customer/meta.tpl





{if $controller == "index"}


{else}
{if $meta_description != ""}

{/if}
{if $meta_keywords != ""}

{/if}
{/if}




This was on the old 2.0.12 version of the cart but just thought I'd share what I had to do to make it not auto-generate the meta tags.