本博客用的 Hexo,有一个功能在文章中插入 <!-- more -->
,之前的内容成了摘要,显示在首页上,点击查看更多才跳转到正文页面。
这是手动设置摘要的方法,也有插件可以实现自动选取摘要,例如这次我们要谈到的 chekun/hexo-excerpt: Automatic excerpt generator for Hexo,可以根据设置,以标签为单位进行摘要的选取,避免选取到不完整的内容。
有次在写短文的时候发现,即使除去摘要,正文没有更多内容时,首页还是会显示“查看更多”字样,于是发起了一个 Pull Request,尝试去修正这个问题,我提出的方案是短文不再自动生成摘要。
It seems to be confusing when excerpt is showed and there is no more content, so i add a condition to check if the length of moreNodes is more than zero.
这个更改当天就被合并到主分支了。