The code which displays tags for the Jekyll theme I am using is given below. It currently shows tags in alphabetical order. What should I change to sort via post count? I saw
CodePudding user response:
change {{ tag | first | downcase }}
to {{ tag[1].size | plus: 1000 }}
for sorting with post count.
The problem left is the post will appear in ascending order which can easily solved by reversing the order by adding reverse
after tag are sorted.
{% capture site_tags %}
{% for tag in site.tags %}
{{ tag[1].size | plus: 1000 }}{{ tag | first }}
{% unless forloop.last %}{% endunless %}
{% endfor %}
{% endcapture %}
{% assign site_tags = site_tags | split: '' | sort | reverse %}