v1.9.1
把 capture 开闭标签之间的内容渲染后赋值给一个变量,这个变量的类型总是字符串。
输入
1 | {% capture my_variable %}I am being captured.{% endcapture %} |
输出
1 | I am being captured. |
在 capture 里可以使用 assign 创建的其他变量来构建复杂字符串:
输入
1 | {% assign favorite_food = "pizza" %} |
输出
1 | I am 35 and my favourite food is pizza. |