hexo-theme-yilia icon indicating copy to clipboard operation
hexo-theme-yilia copied to clipboard

文章摘要

Open shuncon opened this issue 6 years ago • 2 comments

gay主可以更新yilia版本 文章自动摘要吗?

shuncon avatar Nov 17 '18 05:11 shuncon

我也想要这功能,但是这主题都好久没更新了

mxy493 avatar Jan 29 '19 04:01 mxy493

hexo-auto-excerpt 可以使用

  1. npm install --save hexo-auto-excerpt

  2. layout/_partial/article.ejs,在div.article-entry中的代码换成下面的

    <% if (index && (post.description || post.excerpt)){ %>
              <% if (post.description){ %>
                  <%- post.description %>
              <% } else { %>
                  <%- post.excerpt %>
              <% } %>
          <% } else { %>
              <% if (is_page()){ %>
                  <%- partial('_partial/page') %>
              <% } %>
            <%- post.content %>
          <% } %>
    
  3. _config.yml 添加下面代码

    auto_excerpt:
        enable: true
        lines: 3
    

bigleek avatar Apr 11 '20 07:04 bigleek