2016-04-26 9 views
0

タグで注文されたすべての投稿を表示するページがあります。私は、いくつかのタグを表示するだけで、すべてを表示する必要はありません。そのようなタグ== xを実装するのは、 "for site.tagsのforタグ"の後にあるものです。私はジキルとルビーに新たなんだと私はどのように行うのか分からない:/jekyllタグ内にifを実装する

{% capture site_tags %}{% for tag in site.tags %}{{tag | first }}{% unless forloop.last %},{% endunless %}{% endfor %}{% endcapture %} 


{% assign tag_words = site_tags | split:',' | sort %} 


<ul class="tags"> 
{% for item in (0..site.tags.size) %}{% unless forloop.last %} 
{% capture this_word %}{{ tag_words[item] }}{% endcapture %} 
<li> 
<a href="#{{ this_word | cgi_escape }}" class="tag">{{ this_word }} 
<span>({{ site.tags[this_word].size }})</span> 
</a> 
</li> 
{% endunless %}{% endfor %} 
</ul> 

<div> 
{% for item in (0..site.tags.size) %}{% unless forloop.last %} 
{% capture this_word %}{{ tag_words[item] }}{% endcapture %} 
<h2 id="{{ this_word | cgi_escape }}">{{ this_word }}</h2> 
{% for post in site.tags[this_word] %}{% if post.title != null %} 
<div> 
<span style="float: left;"> 
<a href="{{ post.url }}">{{ post.title }}</a> 
</span> 
<span style="float: right;"> 
{{ post.date | date_to_string }} 
</span> 
</div> 
<div style="clear: both;"></div> 
{% endif %}{% endfor %} 
{% endunless %}{% endfor %} 
</div> 

答えて

0

変更この:

{% capture site_tags %} 
    {% for tag in site.tags %} 
    {% if tag.title != 'excludedtag' %}...{% endif %} 
    {% endfor %} 
{% endcapture %} 

と変更 ':この中へ

{% capture site_tags %} 
    {% for tag in site.tags %}...{% endfor %} 
{% endcapture %} 

あなたが除外したいタグのタイトルに「excludedtag」を追加します。

関連する問題