-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sidebar with similar posts to the post template.
- Loading branch information
Showing
3 changed files
with
69 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<div class="post_sidebar"> | ||
{% assign headerShown = false %} | ||
{% assign i = 0 %} | ||
{% for post in site.posts %} | ||
{% if page.date == post.date %}{% continue %}{% endif %} | ||
{% for tag in post.tags %} | ||
{% if page.tags contains tag %} | ||
{% if headerShown == false %} | ||
<h3 class="text-center">Similar Posts</h3> | ||
{% assign headerShown = true %} | ||
{% endif %} | ||
<a href="{{ post.url }}">{{ post.title }}</a><br> | ||
{% capture i %}{{ i | plus: 1 }}{% endcapture %} | ||
{% break %} | ||
{% endif %} | ||
{% endfor %} | ||
{% if i == "5" %} | ||
{% break %} | ||
{% endif %} | ||
{% endfor %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters