liquid 操作符 & 真假值 & 数据类型
操作符 & 真假值 & 数据类型
操作符
-
基本操作符
== / != / > / < / <= / >= / or / and{% if product.title == 'Pack' %} This product's title contains the word Pack. {% endif %} -
contains ( 包含 )
适用于检查 字符串 / 数组{% if product.title contains 'Pack' %} This product's title contains the word Pack. {% endif %}
真假值
-
真值 ( Truthy )
除了 `nil` 和 `false` 之外的所有值都是真值。 -
假值 ( Falsy )
在 Liquid 中,`nil `和`false`是假值
数据类型
初始化变量: {% assign %} / {% capture %}
-
String : "hello world!"
-
Number: 12
-
Boolean : true / false
-
Nli : 空值,用于查询一个变量是否存在
-
Array :
你无法只通过 Liquid 语法初始化一个数组。
然而,你可以利用`split`过滤器将一个字符串分割为一个子字符串数组。
<!-- if site.users = "Tobi", "Laura", "Tetsuro", "Adam" -->
{{ site.users[0] }}
---------------------------
output: Tobi

浙公网安备 33010602011771号