0

我无法让 Wintersmith 在index页面上生成摘录。

我看到这个:

if article.intro.length > 0
      != typogr(article.intro).typogrify()
    if article.hasMore
      p.more
        a(href=article.url) more

但我不确定要调整什么长度。我尝试了 1、100、-1,但似乎没有任何东西触发more.

4

1 回答 1

1

该属性包含直到第一个或标记(可配置)article.intro的所有 html 。因此,要控制摘录的长度,您只需将标签添加到您希望介绍和全文之间的分隔符的位置。如果没有找到分隔线,则 intro 将包含整篇文章,并且将为 false。<h2><hr>hasMore

例如

---
title: My Article
---

This would be the intro of the article

## This headline separates intro and full article

And this would be the body

以下是它的实现方式: https ://github.com/jnordberg/wintersmith/blob/master/src/plugins/page.coffee#L113

于 2016-05-04T10:05:04.840 回答