split 根据参数传入的分隔符将字符串分解为数组。split 通常被用于将以逗号为分隔符的字符串转换为数组。 输入 {% assign beatles = "John, Paul, George, Ringo" | split: ", " %} {% for member in beatles %} {{ member }} {% endfor %} 输出 John Paul George Ringo
truncatewords 将字符串截短为指定的单词个数。如果指定的单词数量小于字符串中包含的单词个数,则会在字符串末尾添加一个省略号(…)。 输入 {{ "Ground control to Major Tom." | truncatewords: 3 }} 输出 Ground control to... 自定义省略号 truncatewords 还支持第二个可选参数,用于指定一个字符序列,此字符序列将被添加...