Hi, my site’s search fails silently when I modify a searchbox’s liquid templating to the following. Could someone help me figure out what is wrong in the way I’ve written this conditional?
I don’t see anything wrong with the original conditional (or the new one, come to that). What output are you getting?
What search utility are you using … and how do you know it is “failing silently?” Maybe try setting your Liquid error mode in your config file to strict?
What’s the issue with using the original code? As it looks like text less than 180 chars would still get truncated but that have no effect and so look unchanged.
Have you considered a bad flow in the new code where you check if it less than 180 chars using untouched value, but apply truncation on text with html stripped out?
Consider alternative below where check and apply are done on the same stripped value