Skip to content

Instantly share code, notes, and snippets.

@sadikkuzu
Created June 19, 2019 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sadikkuzu/0702aff23920f9c458df0e4989ef3d8e to your computer and use it in GitHub Desktop.
Save sadikkuzu/0702aff23920f9c458df0e4989ef3d8e to your computer and use it in GitHub Desktop.
Jekyll Liquid site.tags
{% capture site_tags %}{% for tag in site.tags %}{{ tag | first | downcase }}#{{ tag | first }}{% unless forloop.last %},{% endunless %}{% endfor %}{% endcapture %}
{% assign tag_hashes = site_tags | split:',' | sort %}
<ul class="list-group">
{% for hash in tag_hashes %}
{% assign keyValue = hash | split: '#' %}
{% capture tag_word %}{{ keyValue[1] | strip_newlines }}{% endcapture %}
<li class="list-group-item">
<a href="/tags/{{ tag_word }}">
{{ tag_word }}
<span class="badge pull-right">{{ site.tags[tag_word].size }}</span>
</a>
</li>
{% endfor %}
</ul>
{% capture site_tags %}{% for tag in site.tags %}{{ tag[1].size }}#{{ tag | first | downcase }}#{{ tag | first }}{% unless forloop.last %},{% endunless %}{% endfor %}{% endcapture %}
{% assign tag_hashes = site_tags | split:',' | sort %}
<ul class="list-group">
{% for hash in tag_hashes %}
{% assign keyValue = hash | split: '#' %}
{% capture tag_word %}{{ keyValue[2] | strip_newlines }}{% endcapture %}
<li class="list-group-item">
<a href="/tags/{{ tag_word }}">
{{ tag_word }}
<span class="badge pull-right">{{ site.tags[tag_word].size }}</span>
</a>
</li>
{% endfor %}
</ul>
@sadikkuzu
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment