Replace hexo-related-popular-posts with hexo-related-posts (#447)

This commit is contained in:
Mimi 2022-02-07 18:01:41 +08:00 committed by GitHub
parent 2094a764d6
commit 07bd564401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 13 deletions

View File

@ -273,17 +273,11 @@ follow_me:
#RSS: /atom.xml || fa fa-rss #RSS: /atom.xml || fa fa-rss
# Related popular posts # Related popular posts
# Dependencies: https://github.com/tea3/hexo-related-popular-posts # Dependencies: https://github.com/sergeyzwezdin/hexo-related-posts
related_posts: related_posts:
enable: false enable: false
title: # Custom header, leave empty to use the default one title: # Custom header, leave empty to use the default one
display_in_home: false display_in_home: false
params:
maxCount: 5
#PPMixingRate: 0.0
#isDate: false
#isImage: false
#isExcerpt: false
# Post edit # Post edit
# Easily browse and edit blog source code online. # Easily browse and edit blog source code online.

View File

@ -1,13 +1,13 @@
{%- set popular_posts = popular_posts_json(theme.related_posts.params, page) %} {%- if page.related_posts and page.related_posts.length > 0 %}
{%- if popular_posts.json and popular_posts.json.length > 0 %}
<div class="popular-posts-header">{{ theme.related_posts.title or __('post.related_posts') }}</div> <div class="popular-posts-header">{{ theme.related_posts.title or __('post.related_posts') }}</div>
<ul class="popular-posts"> <ul class="popular-posts">
{%- for popular_post in popular_posts.json %} {%- for path in page.related_posts %}
{%- set popular_post = site.posts.findOne({ path: path }) %}
<li class="popular-posts-item"> <li class="popular-posts-item">
{%- if popular_post.date and popular_post.date != '' %} {%- if popular_post.date %}
<div class="popular-posts-date">{{ popular_post.date }}</div> <div class="popular-posts-date">{{ date(popular_post.date) }}</div>
{%- endif %} {%- endif %}
{%- if popular_post.img and popular_post.img != '' %} {%- if popular_post.img %}
<div class="popular-posts-img"><img src="{{ popular_post.img }}" alt="{{ popular_post.title }}"></div> <div class="popular-posts-img"><img src="{{ popular_post.img }}" alt="{{ popular_post.title }}"></div>
{%- endif %} {%- endif %}
<div class="popular-posts-title"><a href="{{ popular_post.path }}" rel="bookmark">{{ popular_post.title }}</a></div> <div class="popular-posts-title"><a href="{{ popular_post.path }}" rel="bookmark">{{ popular_post.title }}</a></div>