Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
Author « Topic »  

RJB
Ecommerce Template Expert

United Kingdom
792 Posts

Posted - 12/30/2018 :  16:55:35  
Hi,

On my proddetail.php page I have <meta name="Description" content="<?php print str_replace('"','"',$productdescription)?>">, but I've noticed that this produces a very long meta description when product descriptions have a lot of text. Is there a way to limit the number of characters in the meta tag?

Richard.

dbdave
ECT Moderator

USA
10468 Posts

Posted - 12/30/2018 :  19:06:20  
I'm sure it's easy and something like I use for .asp
<meta name="Description" content="<%if productdescription<>"" then response.write(Left(productdescription,165)) end if %>"/>

I'll see if I can get you a .php version of that.

***edit - https://www.w3schools.com/php/func_string_substr.asp
That should get you on track. Let me know if you need help.

Edited by - dbdave on 12/30/2018 19:08:33

Andy
ECT Moderator

95440 Posts

Posted - 12/31/2018 :  00:31:29  
Hi Richard

Another option would be to enter your meta description in the product admin page

https://www.ecommercetemplates.com/seo/dynamic-title-meta-php.asp

Andy

Please feel free to review / rate our software

RJB
Ecommerce Template Expert

United Kingdom
792 Posts

Posted - 12/31/2018 :  03:31:28  
Hi Dave / Andy,

I've set it to <meta name="Description" content="<?php echo substr($productdescription,0,320)?> "> which seems to work.

Thanks for your help,

Richard.

dbdave
ECT Moderator

USA
10468 Posts

Posted - 12/31/2018 :  09:35:37  
Hi Richard, it seems Google has been back and forth in the last year about how many characters it reads from meta description, but latest info suggests it's around 170 characters.
Although I must admit I am not sure about the other less popular se's.

Edited by - dbdave on 12/31/2018 09:36:08

RJB
Ecommerce Template Expert

United Kingdom
792 Posts

Posted - 01/01/2019 :  04:10:52  
Thanks Dave, I wasn't sure about the optimum description length but have now reduced this to 170 as suggested.

Richard.
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.02 seconds. Snitz Forums 2000