summaryrefslogtreecommitdiff
path: root/_includes/helpers/tags_list.html
diff options
context:
space:
mode:
Diffstat (limited to '_includes/helpers/tags_list.html')
-rw-r--r--_includes/helpers/tags_list.html30
1 files changed, 30 insertions, 0 deletions
diff --git a/_includes/helpers/tags_list.html b/_includes/helpers/tags_list.html
new file mode 100644
index 0000000..d2518e0
--- /dev/null
+++ b/_includes/helpers/tags_list.html
@@ -0,0 +1,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="{{ 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="{{ site.var.tags_path }}#{{ tag[0] }}-ref">{{ tag[0] }} <span>{{ tag[1].size }}</span></a></li>
+ {% endfor %}
+{% endif %}
+
+{% assign tags_list = null %}