简体   繁体   English

(Shopify) 错误:模板正文部分缺少 {{content_for_layout}}

[英](Shopify) Error: Missing {{content_for_layout}} in the body section of the template

I removed "main" section with "{{content_for_layout}}" in theme.liquid :我在theme.liquid中删除了带有“{{content_for_layout}}”“main”部分:

<main role="main">
  {{ content_for_layout }}
</main>

Then, I got this error as shown below:然后,我得到了这个错误,如下所示:

在此处输入图像描述

It seems like it's impossible to remove it but I really want to remove it.似乎无法删除它,但我真的想删除它。 Are there any ways to remove it?有什么办法可以去掉吗? and it's also OK to get the same effect of removing it.而且去掉它也能得到同样的效果。

You can comment it out as shown below:您可以将其注释掉,如下所示:

{% comment %}  
<main role="main">
  {{ content_for_layout }}
</main>
{% endcomment %}

In addition, you can use style="display: none" in the opening main tag :此外,您可以在开始的主标签中使用style="display: none"

<main role="main" style="display:none">
  {{ content_for_layout }}
</main>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM