
添加模块
打开文件:vim themes/next/layout/_macro/sidebar.swig,找到if theme.links后面的endif,在后面添加:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
{% if theme.recent_posts %} <div class="links-of-blogroll motion-element {{ "links-of-blogroll-" + theme.recent_posts_layout }}"> <div class="links-of-blogroll-title"> <i class="fa fa-history fa-{{ theme.recent_posts_icon | lower }}" aria-hidden="true"></i> {{ theme.recent_posts_title }} </div> <ul class="links-of-blogroll-list"> {% set posts = site.posts.sort('-date') %} {% for post in posts.slice('0', '5') %} <li> <a href="{{ url_for(post.path) }}" title="{{ post.title }}" target="_blank">{{ post.title }}</a> </li> {% endfor %} </ul> </div> {% endif %}
|
配置
在next主题配置文件中添加:
1 2 3
|
recent_posts_title: 近期文章 recent_posts_layout: block recent_posts: true
|
参考:http://bigdatadecode.club/hexo-next%E4%B8%BB%E9%A2%98%E6%B7%BB%E5%8A%A0%E8%BF%91%E6%9C%9F%E6%96%87%E7%AB%A0%E7%89%88%E5%9D%97.html
近期评论