MODX Community

SimpleSearch Extract placeholder not respecting striptags

Summary

I’ve got an issue where using :striptags is not stripping the html from the output of the extract placeholder in SimpleSearch

Step to reproduce

  <div class="extract"><p>[[+extract:striptags]]</p></div>

Here is an excerpt my search tpl, I verified it the correct one by removing this line and the entire extract was removed.

https://mbros.com/ Visit this site, search “Mudroom” and scroll down a bit, you’ll see an image embedded in the extract area.

Observed behavior

HTML tags appear to still be output

Expected behavior

All HTML should be removed.

Environment

MODX 2.7.2 PHP7, L Nginx MP stack, etc.

This is a strange one, but not technically wrong. SimpleSearch is simple. It did find the word mudroom, in the link for the dog photo. What I’m thinking is whatever field is being extracted has that image in it (but I think you figured that out already). If you haven’t changed the property &extractSource then it’s pulling directly from the content field. I haven’t done this myself (or at least not recently) but you could change that to be introtext or some TV by adding property &includeTVs=`1`. Then it should still include the resource, but only extract from the variable you chose as an extract source. Hopefully that solves your issue!