与 Jekyll 相关的职位

杰基尔有一个相关帖子网站(变量)(LINK0),但它通过标签而不是类别进行过滤,并给了我各种奇怪之处。

 1{% unless page.category == null %}
 2  {% capture pageCategory %}{{ page.category }}{% endcapture %}
 3  {% unless site.categories[pageCategory].size == 1 %}
 4    <div class="row related-posts">
 5      <h2 class="text-center">More {{ page.category }} Posts!</h2>
 6      <div class="medium-12 small-12 columns">
 7        {% for post in site.categories[pageCategory] limit:6 %}
 8          {% unless post.title == page.title %}
 9
10           <h3>
11            <a href="{{ site.url }}{{ site.baseurl }}{{ post.url }}">
12              {{ post.title }}
13            </a>
14           </h3>
15
16          {% endunless %}
17        {% endfor %}
18      </div>
19    </div>
20  {% endunless %}
21{% endunless %}
  1. 我简化了显示每个相关帖子的标记,只是为了示范目的更简单。
Published At
Categories with 技术
Tagged with
comments powered by Disqus