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

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

View file

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

View file

@ -33,7 +33,7 @@ title: Categories
{% 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 }}/">{{ category_name }}</a> <a href="{{ site.baseurl }}/categories/{{ category_name | replace: ' ', '-' | downcase | url_encode }}/">{{ category_name }}</a>
<!-- content count --> <!-- content count -->
{% assign top_posts_size = site.categories[category_name] | size %} {% assign top_posts_size = site.categories[category_name] | size %}
<span class="text-muted small font-weight-light pl-2"> <span class="text-muted small font-weight-light pl-2">
@ -63,7 +63,7 @@ title: Categories
<ul class="list-group"> <ul class="list-group">
{% 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>&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 %} {% assign posts_size = site.categories[sub_category] | size %}
<span class="text-muted small font-weight-light pl-2">{{ posts_size }} <span class="text-muted small font-weight-light pl-2">{{ posts_size }}
post{% if posts_size > 1 %}s{% endif %} post{% if posts_size > 1 %}s{% endif %}

View file

@ -20,7 +20,7 @@ title: Tags
{% for t in sorted_tags %} {% for t in sorted_tags %}
<div> <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> </div>
{% endfor %} {% endfor %}