jekylljekyll-extensionsjekyll-bootstrap

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. if a post is long, I will set excerpt_separator in the article, I want to show the excerpt in the post.

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.


Solution

  • You can test your post.content like this :

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