Issue with meta description with double quote marks

Discussion in 'Technical Support' started by performancecentral, Sep 10, 2013.

  1. Hi all,
    When pulling out a listing description for meta title and descriptions, I use:
    <title>{$title} | Performance Central</title>
    <meta name="description" content="{$description|truncate:200}">
    The only issue is, most of my listings (and their titles) have double quote marks, and it ends up cutting up the title and description much shorter than it should be.
    Most of my listings have double quote marks
    Is there some way I would be able to replace the " marks in such a way that they will come up properly in the meta title and descriptions?

    Technically if I could replace them on the fly with " with javascript but unfortunately i'm not quite sure how to integrate it.
    Here is my site:
    www.performancecentral.com.au
    Thanks again
    Adrian
  2. Mike-N-Tosh Owner

    I haven't tested this, but I would suggest trying the smarty replace modifier in combination with truncate. Something like this:
    {$description|replace:'"':'"'|truncate:200}
    Yes that is a single quote then a quote and another single quote ' " ' without the spaces
    performancecentral likes this.
  3. UNREAL thanks so much for that. Smarty is one thing I really haven't done enough reading about. I didn't realise it was so versatile. That worked unreal. I put a 200 character limit on description and a 70 word limit

    If only I could work out a keyword generator... hehe. I am thinking of developing a list of popular terms in one database file that I think are appropriate, and if the description or title contains these, I will develop a meta tag from them.

    Your concept worked perfectly
  4. Mike-N-Tosh Owner

    Glad it worked for you.
  5. Much appreciated. You've made my whole dream of having a Classifieds site of my own an absolute dream come true

    More credit is due to you and your knowledge

    Do you like what I did with the keyword search on the left:
    http://www.performancecentral.com.a...ales&type=5&minprice=&maxprice=&Submit=Search

    You can remove certain search filters (price, keyword, category or state) without removing the others using the little Red X.

    Its a bit old school in its method but seems to work really well so far.
  6. Mike-N-Tosh Owner

    Looks good. One suggestion to give it just a little more polished look is to style the "X" image either inline or through a style sheet, margin:2px 0 0 4px. That centers it vertically and gives a little space between the search field and the "X" image.

Share This Page