Skip to content

Commit

Permalink
move the template to the single file.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsanie committed Feb 9, 2018
1 parent 3a6f571 commit f4fdeb1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
20 changes: 20 additions & 0 deletions layout/_macro/post-related.swig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% set popular_posts = popular_posts_json(theme.related_posts.params, post) %}
{% if popular_posts.json and popular_posts.json.length > 0 %}
<div class="popular-posts-header">{{ theme.related_posts.title | default(__('post.related_posts')) }}</div>
<ul class="popular-posts">
{% for popular_post in popular_posts.json %}
<li class="popular-posts-item">
{% if popular_post.date and popular_post.date != '' %}
<div class="popular-posts-date">{{ popular_post.date }}</div>
{% endif %}
{% if popular_post.img && popular_post.img != '' %}
<div class="popular-posts-img"><img src="{{ popular_post.img }}" /></div>
{% endif %}
<div class="popular-posts-title"><a href="{{ popular_post.path }}" rel="bookmark">{{ popular_post.title }}</a></div>
{% if popular_post.excerpt && popular_post.excerpt != '' %}
<div class="popular-posts-excerpt"><p>{{ popular_post.excerpt }}</p></div>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
21 changes: 1 addition & 20 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -334,26 +334,7 @@
</div>

{% if theme.related_posts.enable and (theme.related_posts.display_in_home or not is_index) %}
{% set popular_posts = popular_posts_json(theme.related_posts.params, post) %}
{% if popular_posts.json and popular_posts.json.length > 0 %}
<div class="popular-posts-header">{{ theme.related_posts.title | default(__('post.related_posts')) }}</div>
<ul class="popular-posts">
{% for popular_post in popular_posts.json %}
<li class="popular-posts-item">
{% if popular_post.date and popular_post.date != '' %}
<div class="popular-posts-date">{{ popular_post.date }}</div>
{% endif %}
{% if popular_post.img && popular_post.img != '' %}
<div class="popular-posts-img"><img src="{{ popular_post.img }}" /></div>
{% endif %}
<div class="popular-posts-title"><a href="{{ popular_post.path }}" rel="bookmark">{{ popular_post.title }}</a></div>
{% if popular_post.excerpt && popular_post.excerpt != '' %}
<div class="popular-posts-excerpt"><p>{{ popular_post.excerpt }}</p></div>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% include 'post-related.swig' with { post: post } %}
{% endif %}

{#####################}
Expand Down

0 comments on commit f4fdeb1

Please sign in to comment.