Tags List

| August 17, 2012 | Coding |


The tag list helper lists tags and their total counts. The tag list helper follows the Jekyll-bootstrap include helper strategy.

Usage

List Sitewide Tags You can list sitewide tags by passing in the site.tags variable:

<ul>
  {% assign tags_list = site.tags %}
  {% include helpers/tags_list.html %}
</ul>

List Tags for a Specific Post You can also list tags specific to a post:

<ul>
  {% assign tags_list = page.tags %}
  {% include helpers/tags_list.html %}
</ul>

List Tags Per Post Iteratively Finally let’s iterate through all posts:

{% for post in site.posts %}
  <h3>Tags for: {{post.title}}</h3>  
  <ul>
    {% assign tags_list = post.tags %}  
    {% include helpers/tags_list.html %}
  </ul>
{% endfor %}

Source The source code is available at:

./_includes/helpers/tags_list.html

Artikel Terkait

Silahkan Berkomentar