简体   繁体   English

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

[英]In Jekyll, How can I judge whether a post used excerpt_separator or not

In my index page, I want to show this: 在我的索引页面中,我想显示:

If a post is short, I will not set the excerpt_separator to make it show the full content, it will display as the same as the single post page. 如果帖子很短,我不会设置excerpt_separator使其显示完整内容,它将显示为与单个帖子页面相同。 if a post is long, I will set excerpt_separator in the article, I want to show the excerpt in the post. 如果帖子很长,我会在文章中设置excerpt_separator,我想在帖子中显示摘录。

In the posts loop of index page,The show template is different between whole article and excerpt,like ellipsis and 'read more' link. 在索引页面的帖子循环中,整个文章和摘录之间的展示模板不同,如省略号和“阅读更多”链接。 So I need to know whether the excerpt separator is used in the current post.How can I judge this,thank you. 所以我需要知道当前帖子中是否使用了摘录分隔符。我怎么判断这个,谢谢。

您可以像这样测试post.content

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM