Datafeedr Support Forums

Datafeedr Support Forums (/index.php)
-   Tips, Tricks & Tutorials (/forumdisplay.php?f=66)
-   -   Shorten Meta Description (/showthread.php?t=7045)

arizonius June 1st, 2012 02:30 PM

Shorten Meta Description

For the product meta description tag, I'm using the following in my View <head> Elements:

<meta name="description" content="[product.description]" />

However, my meta description is then way too long. Is there a way to update the code so that the meta description is capped at, say, 200 characters?

Eric June 1st, 2012 03:00 PM


Yes, this is possible.

Change this:
HTML Code:

<meta name="description" content="[product.description]" />
To this:
HTML Code:

<meta name="description" content="<?php echo substr(strip_tags($product->description), 0, 200); ?>" />

All times are GMT -5. The time now is 01:01 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.