From 8a6aff790f94274f634f8104bc0ec21f951496b6 Mon Sep 17 00:00:00 2001 From: el00ruobuob Date: Tue, 19 Mar 2019 18:11:43 +0100 Subject: [PATCH] Sort tags by popularity in blog --- _layouts/blog_by_tag.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/_layouts/blog_by_tag.html b/_layouts/blog_by_tag.html index 879862e8..15beae43 100644 --- a/_layouts/blog_by_tag.html +++ b/_layouts/blog_by_tag.html @@ -59,10 +59,21 @@ layout: custom

Popular Tags

- {% for tag in site.data.tags limit:4 %} + {% capture taglist %} + {% for site_tag in site.tags %} + {% for data_tag in site.data.tags %} + {% if data_tag.slug == site_tag[0] %} + ;{{ site_tag[1].size | plus: 100000 }}#{{ data_tag.name }}#{{ data_tag.slug }} + {% endif %} + {% endfor %} + {% endfor %} + {% endcapture %} + {% assign sortedtags = taglist | strip | remove_first: ';' | split:';' | sort | reverse %} + {% for tagitem in sortedtags limit: 6 %} + {% assign pop_tag = tagitem | strip | split: '#' %}
{% endfor %}