Allow special characters in categories and tags

This commit is contained in:
Jatin Sanghvi 2019-12-28 00:58:02 -08:00
parent ccbc047e60
commit a819ac95eb
4 changed files with 7 additions and 7 deletions

View file

@ -61,8 +61,8 @@
{% for trend in trends %}
{% assign count = count | plus: 1 %}
{% assign tag = trend | split: ":" | last %}
<a class="post-tag" href="{{ site.baseurl }}/tags/{{ tag | downcase }}/">{{ tag | replace: '-', ' ' }}</a>
{% assign tag = trend | split: ":" | last %}
<a class="post-tag" href="{{ site.baseurl }}/tags/{{ tag | downcase | url_encode }}/">{{ tag | replace: '-', ' ' }}</a>
{% if count >= MAX %}
{% break %}
{% endif %}

View file

@ -20,7 +20,7 @@ layout: default
</span>
{% if page.categories.size > 0 %}on{% endif %}
{% for category in page.categories %}
<a href='{{ site.baseurl }}/categories/{{ category | replace: ' ', '-' | downcase }}/'>{{ category }}</a>
<a href='{{ site.baseurl }}/categories/{{ category | replace: ' ', '-' | downcase | url_encode }}/'>{{ category }}</a>
{%- unless forloop.last -%}, {%- endunless -%}
{% endfor %}
</div>
@ -62,7 +62,7 @@ layout: default
{% if page.tags.size > 0 %}
<div class="mb-4">
{% for tag in page.tags %}
<a href="{{ site.baseurl }}/tags/{{ tag | replace: ' ', '-' | downcase }}/"
<a href="{{ site.baseurl }}/tags/{{ tag | replace: ' ', '-' | downcase | url_encode }}/"
class="post-tag no-text-decoration" >
{{- tag -}}
</a>

View file

@ -33,7 +33,7 @@ title: Categories
{% else %}
<i class="far fa-folder fa-fw"></i>
{% endif %}
<a href="{{ site.baseurl }}/categories/{{ category_name | replace: ' ', '-' | downcase }}/">{{ category_name }}</a>
<a href="{{ site.baseurl }}/categories/{{ category_name | replace: ' ', '-' | downcase | url_encode }}/">{{ category_name }}</a>
<!-- content count -->
{% assign top_posts_size = site.categories[category_name] | size %}
<span class="text-muted small font-weight-light pl-2">
@ -63,7 +63,7 @@ title: Categories
<ul class="list-group">
{% for sub_category in sub_categories %}
<li class="list-group-item">
<i class="far fa-folder fa-fw"></i>&nbsp;<a href="{{ site.baseurl }}/categories/{{ sub_category | replace: ' ', '-' | downcase }}/">{{ sub_category }}</a>
<i class="far fa-folder fa-fw"></i>&nbsp;<a href="{{ site.baseurl }}/categories/{{ sub_category | replace: ' ', '-' | downcase | url_encode }}/">{{ sub_category }}</a>
{% assign posts_size = site.categories[sub_category] | size %}
<span class="text-muted small font-weight-light pl-2">{{ posts_size }}
post{% if posts_size > 1 %}s{% endif %}

View file

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