2020-05-09 18:28:18 +02:00
|
|
|
{% comment %}
|
2019-12-31 16:17:27 +01:00
|
|
|
The trending tags list
|
2020-01-02 14:17:49 +01:00
|
|
|
v2.0
|
|
|
|
https://github.com/cotes2020/jekyll-theme-chirpy
|
2019-12-31 16:17:27 +01:00
|
|
|
© 2019 Cotes Chung
|
|
|
|
MIT Licensed
|
2020-05-09 18:28:18 +02:00
|
|
|
{% endcomment %}
|
2019-12-31 16:17:27 +01:00
|
|
|
|
|
|
|
{% assign MAX = 10 %}
|
|
|
|
|
|
|
|
{% capture tags_array %}
|
|
|
|
{% for tag in site.tags %}
|
2020-05-09 18:28:18 +02:00
|
|
|
{{ tag[1] | size }}::{{ tag[0] | replace: ' ', '-' }}
|
2019-12-31 16:17:27 +01:00
|
|
|
{% endfor %}
|
|
|
|
{% endcapture %}
|
|
|
|
|
2020-05-09 18:28:18 +02:00
|
|
|
{% assign all_tags = tags_array | split: " " | sort | reverse %}
|
2019-12-31 16:17:27 +01:00
|
|
|
{% assign count = 0 %}
|
|
|
|
|
2020-05-09 18:28:18 +02:00
|
|
|
{% assign trending_tags = "" | split: "" %}
|
|
|
|
|
|
|
|
{% for iter in all_tags %}
|
2019-12-31 16:17:27 +01:00
|
|
|
{% assign count = count | plus: 1 %}
|
2020-05-09 18:28:18 +02:00
|
|
|
{% assign tag = iter | split: "::" | last %}
|
|
|
|
|
|
|
|
{% assign trending_tags = trending_tags | push: tag %}
|
|
|
|
|
2019-12-31 16:17:27 +01:00
|
|
|
{% if count >= MAX %}
|
|
|
|
{% break %}
|
|
|
|
{% endif %}
|
2020-05-09 18:28:18 +02:00
|
|
|
{% endfor %}
|