Slugify tag and category links (#947)

Fixes links to jekyll-archive pages when tag/category contains spaces.
This commit is contained in:
Simmo Saan 2022-10-16 14:06:52 +03:00 committed by GitHub
parent 7d7567eac8
commit 5f3c487b7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,7 @@ layout: default
{%- if tags != "" %} {%- if tags != "" %}
  ·     ·  
{% for tag in page.tags -%} {% for tag in page.tags -%}
<a href="{{ tag | prepend: '/blog/tag/' | prepend: site.baseurl}}"> <a href="{{ tag | slugify | prepend: '/blog/tag/' | prepend: site.baseurl}}">
<i class="fas fa-hashtag fa-sm"></i> {{ tag }}</a> &nbsp; <i class="fas fa-hashtag fa-sm"></i> {{ tag }}</a> &nbsp;
{% endfor -%} {% endfor -%}
{% endif %} {% endif %}
@ -31,7 +31,7 @@ layout: default
{%- if categories != "" %} {%- if categories != "" %}
&nbsp; &middot; &nbsp; &nbsp; &middot; &nbsp;
{% for category in page.categories -%} {% for category in page.categories -%}
<a href="{{ category | prepend: '/blog/category/' | prepend: site.baseurl}}"> <a href="{{ category | slugify | prepend: '/blog/category/' | prepend: site.baseurl}}">
<i class="fas fa-tag fa-sm"></i> {{ category }}</a> &nbsp; <i class="fas fa-tag fa-sm"></i> {{ category }}</a> &nbsp;
{% endfor -%} {% endfor -%}
{% endif %} {% endif %}

View File

@ -25,7 +25,7 @@ pagination:
<ul class="p-0 m-0"> <ul class="p-0 m-0">
{% for tag in site.display_tags %} {% for tag in site.display_tags %}
<li> <li>
<i class="fas fa-hashtag fa-sm"></i> <a href="{{ tag | prepend: '/blog/tag/' | relative_url }}">{{ tag }}</a> <i class="fas fa-hashtag fa-sm"></i> <a href="{{ tag | slugify | prepend: '/blog/tag/' | relative_url }}">{{ tag }}</a>
</li> </li>
{% unless forloop.last %} {% unless forloop.last %}
<p>&bull;</p> <p>&bull;</p>
@ -77,7 +77,7 @@ pagination:
{% if tags != "" %} {% if tags != "" %}
&nbsp; &middot; &nbsp; &nbsp; &middot; &nbsp;
{% for tag in post.tags %} {% for tag in post.tags %}
<a href="{{ tag | prepend: '/blog/tag/' | prepend: site.baseurl}}"> <a href="{{ tag | slugify | prepend: '/blog/tag/' | prepend: site.baseurl}}">
<i class="fas fa-hashtag fa-sm"></i> {{ tag }}</a> &nbsp; <i class="fas fa-hashtag fa-sm"></i> {{ tag }}</a> &nbsp;
{% endfor %} {% endfor %}
{% endif %} {% endif %}
@ -85,7 +85,7 @@ pagination:
{% if categories != "" %} {% if categories != "" %}
&nbsp; &middot; &nbsp; &nbsp; &middot; &nbsp;
{% for category in post.categories %} {% for category in post.categories %}
<a href="{{ category | prepend: '/blog/category/' | prepend: site.baseurl}}"> <a href="{{ category | slugify | prepend: '/blog/category/' | prepend: site.baseurl}}">
<i class="fas fa-tag fa-sm"></i> {{ category }}</a> &nbsp; <i class="fas fa-tag fa-sm"></i> {{ category }}</a> &nbsp;
{% endfor %} {% endfor %}
{% endif %} {% endif %}