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
# Related popular posts
# Dependencies: https://github.com/tea3/hexo-related-popular-posts
# Dependencies: https://github.com/sergeyzwezdin/hexo-related-posts
related_posts:
enable: false
title: # Custom header, leave empty to use the default one
display_in_home: false
params:
maxCount: 5
#PPMixingRate: 0.0
#isDate: false
#isImage: false
#isExcerpt: false
# Post edit
# 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 popular_posts.json and popular_posts.json.length > 0 %}
{%- if page.related_posts and page.related_posts.length > 0 %}
<div class="popular-posts-header">{{ theme.related_posts.title or __('post.related_posts') }}</div>
<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">
{%- if popular_post.date and popular_post.date != '' %}
<div class="popular-posts-date">{{ popular_post.date }}</div>
{%- if popular_post.date %}
<div class="popular-posts-date">{{ date(popular_post.date) }}</div>
{%- 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>
{%- endif %}
<div class="popular-posts-title"><a href="{{ popular_post.path }}" rel="bookmark">{{ popular_post.title }}</a></div>