ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to remove formatting from text to use in a meta tag?

December 01, 2010 4:06pm

Subscribe [4]
  • #1 / Dec 01, 2010 4:06pm

    roryrabbitfield

    320 posts

    I am trying to create dynamically generated meta keywords & descriptions for products that I have in a channel. I want to stick my custom “text description” field for a product into the meta description tag for the product single entry pages.

    But, the problem is that this field is a WYGWAM field, and so has HTML hidden in it for formatting that text. I want to strip out that HTML text to use just the “plain text” in the meta description tag. Is this possible?

  • #2 / Dec 02, 2010 10:16am

    Sue Crocker

    26054 posts

    Hi, Rory. Is there a reason you are using WYGWAM instead of a textarea field? You shouldn’t need the extra functionality of WYGWAM.

  • #3 / Dec 02, 2010 11:04am

    roryrabbitfield

    320 posts

    Hi Sue!

    Yes: I am using the field as the product description, and the client likes to format that (add links, bold, etc). So I need a stripped down version to use for the meta description.

    I asked around and was told to use HTML Strip, which is some sort of utility that strips the HTML out of the field. This sound perfect. Now I just need to find that and install it etc.

    Update: It turns out that HTMLStrip is not available for EE2. Instead, this seems to fit the bill:

    SuperGeekery Tag Stripper
    http://devot-ee.com/add-ons/supergeekery-tag-stripper/

    This forum post talks about this issue:
    http://ellislab.com/forums/viewthread/162034/

  • #4 / Dec 03, 2010 12:24am

    roryrabbitfield

    320 posts

    A further update: SuperGeekery just updated the tag stripper add-on to include conversion of quotes into HTML entities so that quotes in the text don’t mess up your tags. Wow, very exciting. it works great.

  • #5 / Dec 03, 2010 9:59am

    Ingmar

    29245 posts

    So, just making sure, that fixes you up? Ready to close this one out?

  • #6 / Dec 03, 2010 12:38pm

    roryrabbitfield

    320 posts

    All set here. Over and out.

  • #7 / Dec 04, 2010 2:52pm

    Greg Salt

    3988 posts

    Hi Rory,

    Glad that you got this resolved. Please post back if required.

    Cheers

    Greg

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases