Skip to content

Commit

Permalink
fix error when click on a tag/category with space
Browse files Browse the repository at this point in the history
  • Loading branch information
Simpleyyt committed Aug 12, 2017
1 parent d8bacb1 commit 1f1bea9
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion _includes/_helper/list_categories.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<li class="category-list-item">
{% assign cat = cat_posts[0] %}
{% assign posts = cat_posts[1] %}
{% assign cat_url_encode = cat | uri_encode %}
{% assign cat_url_encode = cat | url_encode | replace: '+', '%20' %}
<a class="category-list-link" href="{{ '/category/#/' | relative_url | append: cat_url_encode }}">{{ cat }}</a>
<span class="category-list-count">{{ posts.size }}</span>
</i>
Expand Down
2 changes: 1 addition & 1 deletion _includes/_helper/tagcloud.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
{% assign mid_color = 'rgb(' | append: mid_color[0] | append: ',' | append: mid_color[1] | append: ',' | append: mid_color[2] | append: ')' %}
{% assign style = style | append: 'color: ' | append: mid_color %}
{% endif %}
{% assign tag_url_encode = tag[0] | uri_encode %}
{% assign tag_url_encode = tag[0] | url_encode | replace: '+', '%20' %}
<a href="{{ '/tag/#/' | relative_url | append: tag_url_encode }}" style="{{ style }}">{{ tag[0] }}</a>
{% endfor %}

Expand Down
4 changes: 2 additions & 2 deletions _includes/_macro/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<span class="post-meta-item-text">{{ __.post.in }}</span>
{% endif %}
{% for cat in post.categories %}
{% assign cat_url_encode = cat | uri_encode %}
{% assign cat_url_encode = cat | url_encode | replace: '+', '%20' %}
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="{{ '/category/#/' | relative_url | append: cat_url_encode }}" itemprop="url" rel="index">
<span itemprop="name">{{ cat }}</span>
Expand Down Expand Up @@ -341,7 +341,7 @@
{% if post.tags and post.tags.size != 0 and is_index == nil or is_index == false %}
<div class="post-tags">
{% for tag in post.tags %}
{% assign tag_url_encode = tag | uri_encode %}
{% assign tag_url_encode = tag | url_encode | replace: '+', '%20' %}
<a href="{{ '/tag/#/' | relative_url | append: tag_url_encode }}" rel="tag"># {{ tag }}</a>
{% endfor %}
</div>
Expand Down
2 changes: 1 addition & 1 deletion _includes/_scripts/pages/pagination.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

{% capture maps %}
{% for name_posts in collections %}
'{{ name_posts[0] | uri_encode }}': {{ name_posts[1].size }},
'{{ name_posts[0] | url_encode | replace: '+', '%20' }}': {{ name_posts[1].size }},
{% endfor %}
{% endcapture %}
{% assign maps = maps | normalize_whitespace %}
Expand Down
2 changes: 1 addition & 1 deletion _includes/category.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{% assign paginate_path = site.category.paginate_path | default: site.paginate_path %}

{% for cat_posts in site.categories %}
{% assign cat = cat_posts[0] | uri_encode %}
{% assign cat = cat_posts[0] | url_encode | replace: '+', '%20' %}
{% assign posts = cat_posts[1] %}

{% for post in posts %}
Expand Down
2 changes: 1 addition & 1 deletion _includes/tag.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{% assign paginate_path = site.tag.paginate_path | default: site.paginate_path %}

{% for tag_posts in site.tags %}
{% assign tag = tag_posts[0] | uri_encode %}
{% assign tag = tag_posts[0] | url_encode | replace: '+', '%20' %}
{% assign posts = tag_posts[1] %}

{% for post in posts %}
Expand Down

0 comments on commit 1f1bea9

Please sign in to comment.