-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace
site.related_posts
with Liquid to display better matches ba…
…sed on tags - Close #554
- Loading branch information
Showing
6 changed files
with
63 additions
and
23 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
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,26 @@ | ||
{% comment %}<!-- show posts by related tags when `related: true` -->{% endcomment %} | ||
{% if page.related %} | ||
{% assign n_posts = 0 %} | ||
{% for post in site.posts %} | ||
{% if post.id == page.id %}{% continue %}{% endif %} | ||
{% for this_tag in page.tags %} | ||
{% if post.tags contains this_tag %} | ||
{% if n_posts == 0 %} | ||
<div class="page__related"> | ||
{% if site.data.ui-text[site.locale].related_label %} | ||
<h4 class="page__related-title">{{ site.data.ui-text[site.locale].related_label | default: "You May Also Enjoy" }}</h4> | ||
{% endif %} | ||
<div class="grid__wrapper"> | ||
{% endif %} | ||
{% include archive-single.html type="grid" %} | ||
{% assign n_posts = n_posts | plus: 1 %} | ||
{% break %} | ||
{% endif %} | ||
{% endfor %} | ||
{% if n_posts > 3 %}{% break %}{% endif %} | ||
{% endfor %} | ||
{% if n_posts > 0 %} | ||
</div> | ||
</div> | ||
{% endif %} | ||
{% endif %} |
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
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,26 @@ | ||
{% comment %}<!-- show posts by related tags when `related: true` -->{% endcomment %} | ||
{% if page.related %} | ||
{% assign n_posts = 0 %} | ||
{% for post in site.posts %} | ||
{% if post.id == page.id %}{% continue %}{% endif %} | ||
{% for this_tag in page.tags %} | ||
{% if post.tags contains this_tag %} | ||
{% if n_posts == 0 %} | ||
<div class="page__related"> | ||
{% if site.data.ui-text[site.locale].related_label %} | ||
<h4 class="page__related-title">{{ site.data.ui-text[site.locale].related_label | default: "You May Also Enjoy" }}</h4> | ||
{% endif %} | ||
<div class="grid__wrapper"> | ||
{% endif %} | ||
{% include archive-single.html type="grid" %} | ||
{% assign n_posts = n_posts | plus: 1 %} | ||
{% break %} | ||
{% endif %} | ||
{% endfor %} | ||
{% if n_posts > 3 %}{% break %}{% endif %} | ||
{% endfor %} | ||
{% if n_posts > 0 %} | ||
</div> | ||
</div> | ||
{% endif %} | ||
{% endif %} |
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