Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate hexo-recommended-posts plugin #2054

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ post_wordcount:
totalcount: false
separated_meta: true

# Recommended posts
# Dependency: https://github.com/huiwang/hexo-recommended-posts
recommended_posts:
enabled: false

# Wechat Subscriber
#wechat_subscriber:
#enabled: true
Expand Down
1 change: 1 addition & 0 deletions languages/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ post:
license_title: Copyright Notice
license_content: 'All articles in this blog are licensed under
<a href="%s" rel="external nofollow" target="_blank">%s</a> unless stating additionally.'
recommended_posts: Recommended Posts

page:
totally: Totally
Expand Down
1 change: 1 addition & 0 deletions languages/fr-FR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ post:
license_title: Copyright Notice
license_content: 'All articles in this blog are licensed under
<a href="%s" rel="external nofollow" target="_blank">%s</a> unless stating additionally.'
recommended_posts: articles Recommandées

page:
totally: Total
Expand Down
1 change: 1 addition & 0 deletions languages/zh-Hans.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ post:
license_title: 版权声明
license_content: '本博客所有文章除特别声明外,均采用
<a href="%s" rel="external nofollow" target="_blank">%s</a> 许可协议。转载请注明出处!'
recommended_posts: 推荐文章

page:
totally: 共有
Expand Down
6 changes: 6 additions & 0 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,12 @@
{### END POST BODY ###}
{#####################}

{% if theme.recommended_posts.enabled and not is_index %}
<div>
{% include 'recommended_posts.swig' with {post: post, site: site} %}
</div>
{% endif %}

{% if theme.wechat_subscriber.enabled and not is_index %}
<div>
{% include 'wechat-subscriber.swig' %}
Expand Down
11 changes: 11 additions & 0 deletions layout/_macro/recommended_posts.swig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="recommended_posts">
{% set recommended_posts = recommended_posts(post, site) %}
{% if recommended_posts.length > 0 %}
<h1>{{ __('post.recommended_posts') }} </h1>
<ul>
{% for link in recommended_posts %}
<li><a href="{{ link.permalink }}">{{ link.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
</div>