Loops Shopify中的博客循环不起作用
我的index.liquid中有以下代码块Loops Shopify中的博客循环不起作用,loops,blogs,shopify,Loops,Blogs,Shopify,我的index.liquid中有以下代码块 <div class="news-notable"> <h2>New & Notable</h2> <ul> {% for article in blogs[blog.news].articles limit: 4 %} <li><a href="{{ arti
<div class="news-notable">
<h2>New & Notable</h2>
<ul>
{% for article in blogs[blog.news].articles limit: 4 %}
<li><a href="{{ article.url }}">{{ article.title }}</a><br />
<span class="date">{{ article.published_at | date: '%b %d, %Y' }}</span></li>
{% endfor %}
</ul>
</div>
这也没用。
提前感谢您的帮助 您需要将blog句柄包含在方括号内 例如,如果您的博客句柄是
news
,则For循环将是:
{% for article in blogs[news].articles limit: 4 %}
...
{% endfor %}
或:
啊,好吧,有道理。我回家后会试试这个。非常感谢。没问题,很乐意帮忙!
{% for article in blogs[news].articles limit: 4 %}
...
{% endfor %}
{% for article in blogs.news.articles limit: 4 %}
...
{% endfor %}