summaryrefslogtreecommitdiff
path: root/_includes/helpers/tags_list.html
blob: f0ee45fc44144b58f4fdaf8fbed2fb32c21263f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{% comment %}<!--
The tags_list include is a listing helper for tags.
Usage:
  1) assign the 'tags_list' variable to a valid array of tags.
  2) include helpers/tags_list.html.
  example:
    <ul>
  	  {% assign tags_list = site.tags %}  
  	  {% include helpers/tags_list.html %}
  	</ul>
  
  Notes: 
    Tags can be either a Hash of tag objects (hashes) or an Array of tag-names (strings).
    The encapsulating 'if' statement checks whether tags_list is a Hash or Array.
    site.tags is a Hash while page.tags is an array.
    
  This helper can be seen in use at: ../_layouts/default.html
-->{% endcomment %}

{% if tags_list.first[0] == null %}
  {% for tag in tags_list %} 
  	<li><a href="{{ BASE_PATH }}{{ site.var.tags_path }}#{{ tag }}-ref">{{ tag }} <span>{{ site.tags[tag].size }}</span></a></li>
  {% endfor %}
{% else %}
  {% for tag in tags_list %} 
  	<li><a href="{{ BASE_PATH }}{{ site.var.tags_path }}#{{ tag[0] }}-ref">{{ tag[0] }} <span>{{ tag[1].size }}</span></a></li>
  {% endfor %}
{% endif %}

{% assign tags_list = null %}