在Jekyll中,我如何判断帖子是否使用了excerpt_separator

时间:2015-10-19 02:57:36

标签: jekyll jekyll-extensions jekyll-bootstrap

在我的索引页面中,我想展示一下:

如果帖子很短,我不会设置excerpt_separator使其显示完整内容,它将显示为与单个帖子页面相同。 如果帖子很长,我会在文章中设置excerpt_separator,我想在帖子中显示摘录。

在索引页面的帖子循环中,整篇文章和摘录之间的展示模板不同,如省略号和“阅读更多”。链接。所以我需要知道当前帖子中是否使用了摘录分隔符。我怎么判断这个,谢谢。

1 个答案:

答案 0 :(得分:3)

您可以像这样测试post.content

{% if post.content contains site.excerpt_separator %}