diff options
Diffstat (limited to '_includes/similar-posts.liquid')
-rw-r--r-- | _includes/similar-posts.liquid | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/_includes/similar-posts.liquid b/_includes/similar-posts.liquid index be5ef52..0dddca2 100644 --- a/_includes/similar-posts.liquid +++ b/_includes/similar-posts.liquid @@ -5,19 +5,24 @@ <ul class="menu-list"> {% for post in collections.posts.pages %} - {% if post.categories contains page.categories.first %} - <li> - <a href="{{ post.permalink }}"> - {% if post.published_date %} - <span class="tag is-rounded"> - {{ post.published_date | date: "%e %b %Y" }} - </span> - {% endif %} + {% + if post.categories + and page.categories + and page.title != post.title + and post.categories contains page.categories.first + %} + <li> + <a href="/{{ post.permalink }}"> + {% if post.published_date %} + <span class="tag is-rounded"> + {{ post.published_date | date: "%e %b %Y" }} + </span> + {% endif %} - {{ post.title }} - </a> - </li> - {% endif %} - {% endfor %} + {{ post.title }} + </a> + </li> + {% endif %} + {% endfor %} </ul> </aside> |