lib/liquid/standardfilters.rb
# Truncate string down to x words
Truncate string down to x words
Truncate string down to x words
def truncatewords(input, words = 15)    
      wordlist = [input.to_s.split].flatten
      if wordlist.size > words.to_i
        wordlist[0..words.to_i].join(' ') + '&hellip;'
      else
        input
      end
    end
def truncatewords ( input , words = 15 ) wordlist = [ input . to_s . split ] . flatten if wordlist . size > words . to_i wordlist [ 0 .. words . to_i ] . join ( ' ' ) + '&hellip;' else input end end
Truncate string down to x words
Truncate string down to x words
input
<not_specific>
words
<not_specific>