It looks like currently HTML code in entries is converted to entities and displayed in search results. This is currently breaking my design since it seems the cell wants to be as wide as it decides it’s going to be instead of using the width I’ve assigned it (here’s an example or if that’s old, just try searching for “leah”)
Wouldn’t it be wiser for HTML code to be stripped completely from the search results to avoid things like this from happening? It doesn’t really look good either when a bunch of HTML is displayed in the excerpt. I don’t have much use for summary fields and don’t use them, therefore my excerpt is always pulled from the main entry.
I have the same problem, just figured it was me and well - was too much going on to post here. But I’d rather it *respect* the HTML because it looks really crappy otherwise. =)
The problem with keeping the HTML intact is that there’s a cutoff after a certain number of characters so you’d have open tags. I’m skeptical about resolving open tags (I still think that looks tacky) and would prefer the HTML to be stripped altogether since that won’t look bad.
What about an option to restrict search results to the first paragraph or something? I guess thats a problem where one is not using p tags or something, though…..
If it were up to me I’d respect the html but if there is a tag in there, make sure it is closed before ending the excerpt - html code should not count against the character count….
If it’s going to go that route, I’d rather it be optional. I don’t really want links and lists, etc showing up in my search results. I frequently use a lot of HTML in my entries and having that show up in the search results would be ugly.
Stripping the HTML out completely would require inputting maybe one or two lines of code - it’d be an easy hack I’m sure. Closing tags is far more intuitive and complex.
Yeah, that would work. I made a terribly simple plugin that strips HTML for other uses, but of course that doesn’t work on search engine results since they’re converted into entities.
So… how did that plugin turn out, Lynda? I would be interested in using it as well in search results, as long as there’s no hacking of the EE files in order for it to work.
It’s funny. Three people requested this plugin via email and not a single person ever got back to me about it. So, I can only assume it worked perfectly or was utter crap.
If you want your search results to end at a point other than what EE considers to be the 50th word, you can use the Filter_HTML plugin to do the job. You can ask it to strip tags too. The only catch is that you need to insert a hack into EE code that provides a variable that evaluates to the full entry rather than just the first 50 words (so Filter_HTML can see the original HTML and do its own thinking about where to truncate it).
If you’re happy with 50 words (or what EE considers to be 50 words), or if you don’t want to add a hack, Paul’s solution is best.