正确的语法以在 Liquid 中添加带有变量的静态行

问题描述 投票:0回答:0

我正在尝试在我的 Liquid Product.Template 文件中添加代码,以包含基于产品标签的 Youtube 视频(我的 POS 系统仅将某些数据传递给 Shopify,标签就是其中之一)

我设法把代码记下来,所以变量 tag_parts.last 是 Youtube 文件名

我正在为将行作为模板的一部分而苦苦挣扎:

`            {%- for tag in product.tags -%}
                    {%- assign tag_parts = tag | split: '_' -%}
                    {%- if tag_parts.first == "video" -%}
                    <div id="product-description"> 
                      <iframe width="455" height="809" class="bg-video" src="https://www.youtube.com/embed/{{tag_parts.last}}?autoplay=1&mute=1&controls=0&loop=1&playlist={{tag_parts.last}}" frameBorder="0" allowFullScreen allow="autoplay"></iframe>
                    </div>
                    {%- endif -%}
            {%- endfor -%}  `

我知道我需要转义某些字符,但经过几天的尝试,我承认我需要帮助。

iFrame Line 的哪些部分需要流式语法?

shopify liquid shopify-template
© www.soinside.com 2019 - 2024. All rights reserved.