Fix underscores in the links of tags/categories (#199)

This commit is contained in:
Cotes Chung 2020-12-11 23:05:36 +08:00
parent 289ce1263d
commit b8ee5a7b0c
6 changed files with 15 additions and 15 deletions

View file

@ -37,9 +37,9 @@
<span>{{- site.data.label.panel.trending_tags -}}</span> <span>{{- site.data.label.panel.trending_tags -}}</span>
<div class="d-flex flex-wrap mt-3 mb-1 mr-3"> <div class="d-flex flex-wrap mt-3 mb-1 mr-3">
{% for tag in trending_tags %} {% for tag_name in trending_tags %}
{% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %} {% assign url = tag_name | slugify | url_encode | prepend: "/tags/" | append: "/" %}
<a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a> <a class="post-tag" href="{{ url | relative_url }}">{{ tag_name }}</a>
{% endfor %} {% endfor %}
</div> </div>

View file

@ -13,7 +13,7 @@
{% include trending-tags.html %} {% include trending-tags.html %}
{% for tag in trending_tags %} {% for tag in trending_tags %}
{% capture url %}/tags/{{ tag | downcase | url_encode }}/{% endcapture %} {% capture url %}/tags/{{ tag | slugify | url_encode }}/{% endcapture %}
<a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a> <a class="post-tag" href="{{ url | relative_url }}">{{ tag | replace: '-', ' ' }}</a>
{% endfor %} {% endfor %}

View file

@ -15,7 +15,7 @@
{% assign size = tag | last | size %} {% assign size = tag | last | size %}
{% assign size_list = size_list | push: 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 %} {% assign tag_list = tag_list | push: tag_str %}
{% endfor %} {% endfor %}

View file

@ -46,7 +46,7 @@ layout: page
{% else %} {% else %}
<i class="far fa-folder fa-fw"></i> <i class="far fa-folder fa-fw"></i>
{% endif %} {% endif %}
<a href="{{ site.baseurl }}/categories/{{ category_name | replace: ' ', '-' | downcase | url_encode }}/" <a href="{{ site.baseurl }}/categories/{{ category_name | slugify | url_encode }}/"
class="ml-1 mr-2"> class="ml-1 mr-2">
{{ category_name }} {{ category_name }}
</a> </a>
@ -85,7 +85,7 @@ layout: page
{% for sub_category in sub_categories %} {% for sub_category in sub_categories %}
<li class="list-group-item"> <li class="list-group-item">
<i class="far fa-folder fa-fw"></i> <i class="far fa-folder fa-fw"></i>
<a href="{{ site.baseurl }}/categories/{{ sub_category | replace: ' ', '-' | downcase | url_encode }}/" <a href="{{ site.baseurl }}/categories/{{ sub_category | slugify | url_encode }}/"
class="ml-1 mr-2">{{ sub_category }}</a> class="ml-1 mr-2">{{ sub_category }}</a>
{% assign posts_size = site.categories[sub_category] | size %} {% assign posts_size = site.categories[sub_category] | size %}
<span class="text-muted small font-weight-light">{{ posts_size }} <span class="text-muted small font-weight-light">{{ posts_size }}

View file

@ -73,7 +73,7 @@ layout: default
<div class="post-meta mb-3"> <div class="post-meta mb-3">
<i class="far fa-folder-open fa-fw mr-1"></i> <i class="far fa-folder-open fa-fw mr-1"></i>
{% for category in page.categories %} {% for category in page.categories %}
<a href='{{ site.baseurl }}/categories/{{ category | replace: ' ', '-' | downcase | url_encode }}/'>{{ category }}</a> <a href='{{ site.baseurl }}/categories/{{ category | slugify | url_encode }}/'>{{ category }}</a>
{%- unless forloop.last -%}, {%- endunless -%} {%- unless forloop.last -%}, {%- endunless -%}
{% endfor %} {% endfor %}
</div> </div>
@ -84,7 +84,7 @@ layout: default
<div class="post-tags"> <div class="post-tags">
<i class="fa fa-tags fa-fw mr-1"></i> <i class="fa fa-tags fa-fw mr-1"></i>
{% for tag in page.tags %} {% for tag in page.tags %}
<a href="{{ site.baseurl }}/tags/{{ tag | replace: ' ', '-' | downcase | url_encode }}/" <a href="{{ site.baseurl }}/tags/{{ tag | slugify | url_encode }}/"
class="post-tag no-text-decoration" > class="post-tag no-text-decoration" >
{{- tag -}} {{- tag -}}
</a> </a>

View file

@ -19,7 +19,7 @@ layout: page
{% for t in sorted_tags %} {% for t in sorted_tags %}
<div> <div>
<a class="tag" href="{{ site.baseurl }}/tags/{{ t | replace: ' ', '-' | downcase | url_encode }}/">{{ t }}<span class="text-muted">{{ site.tags[t].size }}</span></a> <a class="tag" href="{{ site.baseurl }}/tags/{{ t | slugify | url_encode }}/">{{ t }}<span class="text-muted">{{ site.tags[t].size }}</span></a>
</div> </div>
{% endfor %} {% endfor %}