Skip to content

Commit

Permalink
add code to order tags on top of tags page
Browse files Browse the repository at this point in the history
  • Loading branch information
amirmc committed Aug 17, 2013
1 parent 558ac19 commit c3bf458
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions _includes/amc/ordered_tags_list
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{% if tags_list.first[0] == null %}
{% for tag in tags_list %}
<li><a href="{{ BASE_PATH }}{{ site.JB.tags_path }}#{{ tag }}">{{ tag }}</a></li>
{% endfor %}
{% else %}
{% capture get_items %}
{% for tag in tags_list %}
{{ tag | first | replace: ' ', '_' }}
{% endfor %}
{% endcapture %}

{% capture num_words %}
{{ get_items | split:' ' | sort | join:' ' | number_of_words }}
{% endcapture %}

{% for item in (1..num_words) %}{% capture a_tag %}{{ get_items | split:' ' | sort | join:' ' | truncatewords:item | remove:'...' | split:' ' | last | replace: '_', ' ' }}{% endcapture %}
<li><a href="/tags-test/#{{ a_tag }}">{{ a_tag }}</a></li>

{% endfor %}
{% endif %}

{% assign tags_list = nil %}
{% assign get_items = nil %}
{% assign num_words = nil %}

0 comments on commit c3bf458

Please sign in to comment.