2012-10-16 2 views
3

두 제품을 반복합니다. 첫 번째 제품 페이지에서 잘 분석하는 보조 게시물 (예 : 관련 제조법)을 가져옵니다. 두 번째 제품 페이지에서 파싱합니다 제품 페이지 {{ post.content }}은 구문 분석하지 않습니다. 나는 {{ post.content | markdownify }}으로 해킹 할 수 있습니다. 그러나 그것이 왜 파괴되는지 알고 싶습니다.Jekyll 루프가 두 번째 반복에서 중단됩니다.

{% 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>