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.

HTML discarded in search results

October 21, 2012 10:43pm

Subscribe [2]
  • #1 / Oct 21, 2012 10:43pm

    Visiluna

    92 posts

    ExpressionEngine 2.5.2 - Build Date: 20120606

    I have a template that displays search results. However, the “excerpt” appears to be stripped of all HTML. The field used for excerpts contains HTML in most entries, but the HTML appears to be discarded when being displayed as part of a search result.

    Example:

    Entry contains the following:

    Here is some information about Product Name<sup>®</sup>

    But when output as part of search results, it appears as:

    Here is some information about Product Name®

    Any idea why I might be experiencing this?

    Thanks,
    PJ

  • #2 / Oct 21, 2012 10:46pm

    Visiluna

    92 posts

    Okay, I just answered my own question by reading the User Guide.

    http://ellislab.com/expressionengine/user-guide/modules/search/results.html#excerpt

    But now my question is, WHY is HTML stripped and why isn’t this an option? I need my HTML. The legal department throws a fit any time a ® isn’t superscripted.

    Thanks,
    PJ

  • #3 / Oct 22, 2012 9:07pm

    Shane Eckert

    7174 posts

    Hey there Visiluna,

    Oh man, it sure is! I have no idea why that is the case.

    I would ask that you file this as a Feature Request. But I will also ask an engineer tomorrow about this and see if there is a good reason and a possible way around this. So stay tuned and if I forget to update this thread, feel free to remind me. I have noted to bring it up in our meeting tomorrow.

    Thanks,
    Shane

  • #4 / Oct 25, 2012 9:40pm

    Shane Eckert

    7174 posts

    Hey Visiluna,

    I talked with our engineers and I have an answer for you.

    That excerpt is truncated and to avoid the possibility that you might end up with something like the following, HTML is stripped.

    in Santa Cruz this weekend. <b> Let's go! </b

    Something like that would mess the whole page up. 😊

    Does that make sense?

    Cheers,

  • #5 / Oct 29, 2012 1:15pm

    Visiluna

    92 posts

    It makes some sense. But as evidenced by other content-truncating add-ons out there, it is certainly possible to truncate content without breaking HTML tags.

    Sure would be nice if they could make it a little smarter.

    In the meantime, I have created a separate ‘Summary’ field to display for search results since search results allows you to display any field.

    Thanks,
    PJ

  • #6 / Oct 30, 2012 12:58pm

    Shane Eckert

    7174 posts

    Hey Visiluna,

    Awesome. Yeah, I hear you on the truncating, hopefully that will be changed at some point.

    If you need anything else, please just let me know by opening a new thread.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases