注釋 comment?標記讓你能夠在 Liquid 模板中書寫的內(nèi)容不被輸出。任何書寫在?comment?起始與結(jié)束標記之間的內(nèi)容都不會被輸出,如果是 Liquid 代碼則不會被執(zhí)行。 輸入 Anything you put between {% comment %} and {% endcomment %} tags is turned into a comment. 輸出 Anything you put between tags is turned into a com...
控制流 控制流標記(control flow tag)能夠根據(jù)編程邏輯改變 Liquid 輸出的信息。 if 只有當某個條件為?true?時才執(zhí)行一段代碼。 輸入 {% if product.title == 'Awesome Shoes' %} These shoes are awesome! {% endif %} 輸出 These shoes are awesome! unless 與?if?相對 – 只有當某個條件不成立時才執(zhí)行一段代碼。 輸入 {%...
迭代/循環(huán) 迭代(或循環(huán))標記(iteration tag)用于重復(fù)運行一段代碼。 for 重復(fù)運行一段代碼。for?循環(huán)中所能夠使用的屬性請參考?forloop (object)。 輸入 {% for product in collection.products %} {{ product.title }} {% endfor %} 輸出 hat shirt pants break 循環(huán)過程中若干遇到?break?標記(tag)即停止循環(huán)。 輸入...
原始內(nèi)容 raw?標記臨時禁止處理其所包圍的代碼。如果輸出的內(nèi)容與 Liquid 模板語言有沖突時(例如 Mustache、Handlebars 模板語言)可以避免沖突。 輸入 {% raw %} In Handlebars, {{ this }} will be HTML-escaped, but {{{ that }}} will not. {% endraw %} 輸出 In Handlebars, {{ this }} will be HTML-escaped, but {{{ ...
變量 變量標記(variable tag)用于創(chuàng)建新的 Liquid 變量。 assign 創(chuàng)建一個新變量。 輸入 {% assign my_variable = false %} {% if my_variable != true %} This statement is valid. {% endif %} 輸出 This statement is valid. 將變量用?"?包裹之后則將其當做字符串對待。 輸入 {% assign foo = "bar" %} {{ foo }} 輸出 b...
? Copyright 2023 深圳藍曬科技有限公司. 粵ICP備2023054553號-1