2012-10-16 64 views
3

我正在循環瀏覽兩個產品 - 在帖子視圖頁面上,我在第二個帖子(在該示例中是一個相關的配方)中拉出,它在第一個產品頁面上解析得很好 - 第二個產品頁面{{ post.content }}不會解析。我可以用{{ post.content | markdownify }}來破解它 - 但我想知道它爲什麼破壞。下面是相關的代碼:Jekyll Loop在第二次迭代時突破

{% for post in site.categories.recipe %} 
    {% if post.products contains page.title and post.featured %} 
     <div class="row"> 
      <div class="four columns"> 
      <h4>{{ post.title }}</h4> 
      <ul> 
       <li>Serves {{ post.serves }}</li> 
       <li>Prep: {{ post.time }}</li> 
       <li><a href=" ">Share</a></li> 
      </ul> 

      {{ post.content }} 

      ... 

      <!-- All tags are closed, the rest just isn't relevant --> 

    {% endif %} 
{% endfor %} 

回答

2

的markdownify膜可能使其工作,因爲有可能是不是在你從拉內容編碼特殊字符。我總是忘記把我的&變成&amp;

如果您使用的是默認的Markdown解釋器Maruku,下面列出了可能給您帶來問題的實體以及它們的編碼等價物。 http://maruku.rubyforge.org/entity_test.html和更多關於Maruku的信息。

14

請找我的櫃檯解決方案

<pre> 

{% assign counter=0 %} 

{% for post in site.posts%} 

{% if post.category == 'blog' and counter < 2 %} 
{% assign counter=counter | plus:1 %} 

    {{post.content}} 

{% endif %} 

{% endfor %} 

</pre> 
相關問題