2013-07-14 45 views
1

我已經被在後H2輸出的代碼在我index.liquid博客圈不工作

<div class="news-notable"> 
      <h2>New &amp; 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> 

沒什麼以下塊。我也試過只用

{% for article in blogs.articles %} 

而且這也沒有工作。 在此先感謝您的幫助!

回答

3

您需要在方括號內包含博客句柄

舉例來說,如果你的博客手柄news,你的循環是:

{% for article in blogs[news].articles limit: 4 %} 
... 
{% endfor %} 

或:

{% for article in blogs.news.articles limit: 4 %} 
... 
{% endfor %} 
+0

aahhhhh好是有道理的。當我回家時我會試試這個。謝謝! – user1380540

+0

底部一個工作!非常感謝你:) – user1380540

+0

沒問題,很高興幫助! – mikedidthis