巴克励步
发布于:2025-01-02
{{-、-}}、{%- 和 -%},用于将标记(tag)渲染之后的输出内容的左侧或右侧的空拍符剔除。{% assign my_variable = "tomato" %}
{{ my_variable }}
tomato
assign 标记(tag)添加连字符,可以将渲染之后所输出的空拍符删除:{%- assign my_variable = "tomato" -%}
{{ my_variable }}
tomato
{%- 和 -%}):{% assign username = "John G. Chalmers-Smith" %}
{% if username and username.size > 10 %}
Wow, {{ username }}, you have a long name!
{% else %}
Hello there!
{% endif %}
Wow, John G. Chalmers-Smith, you have a long name!
{%- assign username = "John G. Chalmers-Smith" -%}
{%- if username and username.size > 10 -%}
Wow, {{ username }}, you have a long name!
{%- else -%}
Hello there!
{%- endif -%}
Wow, John G. Chalmers-Smith, you have a long name!