String 使用液体连接字符串

String 使用液体连接字符串,string,jekyll,liquid,static-site,String,Jekyll,Liquid,Static Site,在下面的代码中,我试图设置元素的样式属性。我继承了其他人的代码,因此不清楚两件事: 1-为什么液体对象'{{new.image}}'用引号括起来/ 2-如何将下面代码中的宽度和高度的字符串值与px连接起来。下面的代码不正确 {% for news in page.carousel %} {% assign width = 1920 %} {% assign height = width | times: 20 | divided_by: 100 | times: 140 | divide

在下面的代码中,我试图设置元素的样式属性。我继承了其他人的代码,因此不清楚两件事:

1-为什么液体对象
'{{new.image}}'
用引号括起来/ 2-如何将下面代码中的宽度和高度的字符串值与
px
连接起来。下面的代码不正确

{% for news in page.carousel %}
  {% assign width = 1920 %}
  {% assign height = width | times: 20 | divided_by: 100 | times: 140 | divided_by: 100 %}
  <div class="item img-cover img-fixed {% if forloop.first %}active{% endif %}" style="background-image: url({% pic '{{ news.image }}' %}) width= '{{width | join: "px"}}'  height='{{height | join:"px"}}'">
  <h2>{{ news.text }}</h2>
  </div>
{% endfor %}
{page.carousel%中的新闻%
{%assign width=1920%}
{%分配高度=宽度|乘以:20 |除以| 100 |乘以:140 |除以| 100%}
{{news.text}
{%endfor%}

{%pic来自一个自定义插件。你能说出它的名字吗

用液体连接管柱:

width= '{{width}}px'

width= '{{width | append: "px"}}'