forked from theme-next/hexo-theme-next
-
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.
Merge pull request theme-next#109 from tsanie/feature-related-posts
Feature: related posts, according to theme-next#67
- Loading branch information
Showing
6 changed files
with
62 additions
and
0 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
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,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 %} |
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
22 changes: 22 additions & 0 deletions
22
source/css/_common/components/third-party/related-posts.styl
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,22 @@ | ||
.popular-posts-header { | ||
margin-top: $post-eof-margin-bottom; | ||
margin-bottom: 10px; | ||
font-size: $font-size-headings-base; | ||
border-bottom: 1px solid $gainsboro; | ||
display: block; | ||
} | ||
|
||
ul.popular-posts { | ||
padding: 0; | ||
|
||
.popular-posts-item { | ||
// list-style: none; | ||
margin-left: 2em; | ||
.popular-posts-title { | ||
font-weight: normal; | ||
font-size: $font-size-base; | ||
margin: 0; | ||
line-height: $line-height-base * 1.2; | ||
} | ||
} | ||
} |
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