From b8ee5a7b0cabcc1d88da22d8c1a8710db45c4f81 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 11 Dec 2020 23:05:36 +0800 Subject: [PATCH] Fix underscores in the links of tags/categories (#199) --- _includes/panel.html | 14 +++++++------- _includes/search-results.html | 4 ++-- _includes/trending-tags.html | 2 +- _layouts/categories.html | 4 ++-- _layouts/post.html | 4 ++-- _layouts/tags.html | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/_includes/panel.html b/_includes/panel.html index 190c1f610..767964de2 100644 --- a/_includes/panel.html +++ b/_includes/panel.html @@ -11,9 +11,9 @@
{% include update-list.html %} - + {% if update_list.size > 0 %} - +
{{- site.data.label.panel.lastmod -}}
    @@ -27,7 +27,7 @@
- + {% endif %} {% include trending-tags.html %} @@ -36,10 +36,10 @@
{{- site.data.label.panel.trending_tags -}}
- - {% for tag in trending_tags %} - {% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %} - {{ tag | replace: '-', ' ' }} + + {% for tag_name in trending_tags %} + {% assign url = tag_name | slugify | url_encode | prepend: "/tags/" | append: "/" %} + {{ tag_name }} {% endfor %}
diff --git a/_includes/search-results.html b/_includes/search-results.html index 078f425fb..e22e23dd4 100644 --- a/_includes/search-results.html +++ b/_includes/search-results.html @@ -13,11 +13,11 @@ {% include trending-tags.html %} {% for tag in trending_tags %} - {% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %} + {% capture url %}/tags/{{ tag | slugify | url_encode }}/{% endcapture %} {{ tag | replace: '-', ' ' }} {% endfor %}
- \ No newline at end of file + diff --git a/_includes/trending-tags.html b/_includes/trending-tags.html index 41351e4fb..f884768e4 100644 --- a/_includes/trending-tags.html +++ b/_includes/trending-tags.html @@ -15,7 +15,7 @@ {% assign size = tag | last | size %} {% assign size_list = size_list | push: size %} - {% assign tag_str = tag | first | replace: " ", "-" | append: "::" | append: size %} + {% assign tag_str = tag | first | append: "::" | append: size %} {% assign tag_list = tag_list | push: tag_str %} {% endfor %} diff --git a/_layouts/categories.html b/_layouts/categories.html index 1786cf147..474f983cb 100644 --- a/_layouts/categories.html +++ b/_layouts/categories.html @@ -46,7 +46,7 @@ layout: page {% else %} {% endif %} - {{ category_name }} @@ -85,7 +85,7 @@ layout: page {% for sub_category in sub_categories %}
  • - {{ sub_category }} {% assign posts_size = site.categories[sub_category] | size %} {{ posts_size }} diff --git a/_layouts/post.html b/_layouts/post.html index 1a9133b7b..8d90401b8 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -73,7 +73,7 @@ layout: default
    {% for category in page.categories %} - {{ category }} + {{ category }} {%- unless forloop.last -%}, {%- endunless -%} {% endfor %}
    @@ -84,7 +84,7 @@ layout: default
    {% for tag in page.tags %} - {{- tag -}} diff --git a/_layouts/tags.html b/_layouts/tags.html index 5c7d6325d..9c1923a7c 100644 --- a/_layouts/tags.html +++ b/_layouts/tags.html @@ -19,7 +19,7 @@ layout: page {% for t in sorted_tags %}
    - {{ t }}{{ site.tags[t].size }} + {{ t }}{{ site.tags[t].size }}
    {% endfor %}