Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!

 



Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 

 



 

 www.CustomReportSharing.com 

From the folks who brought you High Rankings!



Photo
- - - - -

Dynamically Created Meta Description


  • Please log in to reply
7 replies to this topic

#1 gsimerlink

gsimerlink

    HR 3

  • Active Members
  • PipPipPip
  • 103 posts
  • Location:Springboro, OH

Posted 23 April 2009 - 10:26 AM

Hi,

We are planning on having our meta description tag on product pages be filled in dynamically with our short product description. If our product description includes characters such as quote marks and the like will it mess up the way the tag is read? In other words since the meta field itself is defined by quotes would throwing a quote in the middle (like an inch mark) throw off how the field is read?

Example: <meta name="description" content="Grill Cloth Black Yard 70" Wide. Open weave grill cloth is virtually 100% acoustically transparent.">

Thanks,
gsimerlink

#2 rolf

rolf

    HR 6

  • Active Members
  • PipPipPipPipPipPip
  • 675 posts
  • Location:Suffolk UK

Posted 23 April 2009 - 10:40 AM

could do, but you could get around this by removing them from the text on the fly.

For instance, if you're using PHP, you could process the variable containing the text as follows...

CODE
$descritpionTag = str_replace("\"", "", $rawDescription);


I'm sure there would be a similar function in ASP or whatever you might be using.

Hope that helps

#3 NASA

NASA

    HR 4

  • Active Members
  • PipPipPipPip
  • 183 posts

Posted 23 April 2009 - 11:13 AM

If the data is being pulled from a DB, you could store the data HTML encoded, or process it as rolf says prior to adding to the rendered HTML doc.

what language are you using and where's the data coming from?

#4 gsimerlink

gsimerlink

    HR 3

  • Active Members
  • PipPipPip
  • 103 posts
  • Location:Springboro, OH

Posted 23 April 2009 - 12:58 PM

QUOTE(NASA @ Apr 23 2009, 12:13 PM) View Post
If the data is being pulled from a DB, you could store the data HTML encoded, or process it as rolf says prior to adding to the rendered HTML doc.

what language are you using and where's the data coming from?


We are using Coldfusion and pull our data from an in house CMS that uses SQL

#5 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 23 April 2009 - 01:39 PM

It's been awhile since I've used CF, but this might help to get ya started. It assumes variable is named mdOutput, so change that as needed to match.

CODE
<CFSET mdOutput = replace(mdOutput,'"','','all')>


Note, that second parameter in the replace() function is a ' " ' (or single quote, double quote, single quote) without any spaces.

#6 gsimerlink

gsimerlink

    HR 3

  • Active Members
  • PipPipPip
  • 103 posts
  • Location:Springboro, OH

Posted 23 April 2009 - 02:20 PM

On the same topic is html encoding of the data bad or is it best to strip it all out and go plain text?

#7 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 23 April 2009 - 07:56 PM

It depends.

If you're only using string data where no html should be present, it's best to strip it out before it's saved to the database. If you need the html, say because the info was going to be displayed later in a table that changes a bit, then you'd be better off saving it as html encoded. I don't remember what it is off the top of my head but I believe CF has a built in function to encode or at least escape html elements.

#8 NASA

NASA

    HR 4

  • Active Members
  • PipPipPipPip
  • 183 posts

Posted 24 April 2009 - 03:33 AM

Well for the example, the quote was being used as the unit of measurement, stripping it out wouldn't work in that case as they want the quote to indicate inches.

Therefore you would need to escape it rather than remove it.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

SPAM FREE FORUM!
 
If you are just registering to spam,
don't bother. You will be wasting your
time as your spam will never see the
light of day!