From 9be80f891fe1cb57b092e15bf579e9c15936fd12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Ganzenm=C3=BCller?= Date: Sat, 6 Feb 2021 02:29:06 +0100 Subject: [PATCH] Use sort_natural instead of custom-logic (#2756) --- _includes/category-list.html | 11 ++--------- _includes/tag-list.html | 11 ++--------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/_includes/category-list.html b/_includes/category-list.html index d684a282..1439f14f 100644 --- a/_includes/category-list.html +++ b/_includes/category-list.html @@ -6,19 +6,12 @@ {% endcase %} {% if site.category_archive.path %} - {% comment %} - - - {% endcomment %} - {% capture page_categories %}{% for category in page.categories %}{{ category | downcase }}|{{ category }}{% unless forloop.last %},{% endunless %}{% endfor %}{% endcapture %} - {% assign category_hashes = page_categories | split: ',' | sort %} + {% assign categories_sorted = page.categories | sort_natural %}

{{ site.data.ui-text[site.locale].categories_label | default: "Categories:" }} - {% for hash in category_hashes %} - {% assign keyValue = hash | split: '|' %} - {% capture category_word %}{{ keyValue[1] | strip_newlines }}{% endcapture %} + {% for category_word in categories_sorted %} {% unless forloop.last %}, {% endunless %} {% endfor %} diff --git a/_includes/tag-list.html b/_includes/tag-list.html index e0d02bfa..b16eca2e 100644 --- a/_includes/tag-list.html +++ b/_includes/tag-list.html @@ -6,19 +6,12 @@ {% endcase %} {% if site.tag_archive.path %} - {% comment %} - - - {% endcomment %} - {% capture page_tags %}{% for tag in page.tags %}{{ tag | downcase }}|{{ tag }}{% unless forloop.last %},{% endunless %}{% endfor %}{% endcapture %} - {% assign tag_hashes = page_tags | split: ',' | sort %} + {% assign tags_sorted = page.tags | sort_natural %}

{{ site.data.ui-text[site.locale].tags_label | default: "Tags:" }} - {% for hash in tag_hashes %} - {% assign keyValue = hash | split: '|' %} - {% capture tag_word %}{{ keyValue[1] | strip_newlines }}{% endcapture %} + {% for tag_word in tags_sorted %} {% unless forloop.last %}, {% endunless %} {% endfor %}