以landscape-plus主题为例:
在D:\hexo\themes\landscape-plus\layout\_widget\
目录下新建 recent_comments.ejs
文件,内容如下:
1 2 3 4 5 6 7 8
| <% if (theme.duoshuo_shortname){ %> <div class="widget-wrap"> <h3 class="widget-title"><%= __('最近评论') %></h3> <div class="widget"> <ul class="ds-recent-comments" data-num-items="5" data-show-avatars="1" data-show-time="1" data-show-title="1" data-show-admin="1" data-excerpt-length="70"></ul> </div> </div> <% } %>
|
注:其中上述代码第5行<ul class="ds-recent-comments" data-num-items="5" data-show-avatars="1" data-show-time="1" data-show-title="1" data-show-admin="1" data-excerpt-length="70"></ul>
按照官方提示可以自行修改:
1 2 3 4 5 6 7
| data-num-items="10" data-show-avatars="1" data-show-time="1" data-show-title="0" data-show-admin="1" data-excerpt-length="70"
|
然后在D:\hexo\themes\landscape-plus
主题目录中的_config.yml
下的widgets
中添加recent_comments
:
1 2 3 4 5 6 7 8
| widgets: - category - recent_posts - archive - tagcloud - tag - links - recent_comments
|
重新部署后刷新即可。
参考: