如何在布局中使用Shopify部分?

发布于 2025-01-21 07:28:44 字数 190 浏览 3 评论 0原文

我有一个可以从Shopify Customizer编辑的内容的部分。我在多个页面上使用此部分,但是内容保持不变。

有没有办法将本节绑定到整个布局?

因为当您更新内容时,您将其重新输入在使用本节的每个页面模板上。我可以在使用布局的所有页面模板上使用静态HTML,但这并不有用,因为该内容需要从Shopify Customizer中进行编辑。

I have a section with content that can be edited from the Shopify Customizer. I use this section across multiple pages, but the content remains the same.

Is there a way to instead bind this section to a whole layout?

Because when you update the content, you have it re-enter it on every single page template that uses this section. I can have static HTML across all page templates that use a layout, but this isn't useful because the content needs to be editable from the Shopify Customizer.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦幻的心爱 2025-01-28 07:28:44

毕竟,您可以在布局上有一个部分。

我正在做

布局/my-new-layout.liquid:
{% render 'section-component.liquid' %}

当我应该做

布局/my-new-layout.liquid时:
{% section 'section-component.liquid' %}

请参考

如果您想将仅模板的部分转换为仅布局的部分, ...

  1. 从模板中删除JSON数据:模板/page.template.json
  2. 在布局(即布局/my-new-layout.liquid.liquid )中添加{%章节'yourSection'%}

You can have a section across a layout after all.

I was doing

layout/my-new-layout.liquid:
{% render 'section-component.liquid' %}

when I was supposed to be doing

layout/my-new-layout.liquid:
{% section 'section-component.liquid' %}

For reference

If you're trying to convert a template-only section to a layout-only section...

  1. Remove the section JSON data from the template: templates/page.your-template.json.
  2. Add a {% section 'your-section' %} in the layout (i.e. layout/my-new-layout.liquid).
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文