Sort tags by post count
This commit is contained in:
parent
238b0e5aad
commit
9a71545421
|
@ -5,7 +5,10 @@ title: Tags
|
||||||
use:
|
use:
|
||||||
- posts_tags
|
- posts_tags
|
||||||
---
|
---
|
||||||
<h1>Blog Tags</h1>
|
{% set rows = {} %}
|
||||||
|
{% for tag, posts in data.posts_tags %}
|
||||||
|
{% set rows = rows|merge({ (tag): posts|length }) %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
|
@ -16,14 +19,12 @@ use:
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for tag, posts in data.posts_tags %}
|
{% for tag, post_count in rows|sort|reverse %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ site.url }}/blog/tags/{{ tag|url_encode(true) }}" class="link">
|
<a href="{{ site.url }}/blog/tags/{{ tag|url_encode(true) }}" class="link">{{ tag }}</a>
|
||||||
{{ tag }}
|
|
||||||
</a>
|
|
||||||
</td>
|
</td>
|
||||||
<td>{{ posts|length }}</td>
|
<td>{{ post_count }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Reference in a new issue