简体   繁体   English

如何仅显示第一段或在Jekyll中定义摘录

[英]How do you display only the first paragraph or define an excerpt in Jekyll

I've prepared this post 我已经准备了这篇文章

---
layout: post
tags:
- tag1
title: Post Title 1
categories:
- category1
---

Excerpt for post 1    

<!-- More -->

Body of post 1

I'm using {{ post.excerpt }} and in _config.yml have set 我正在使用{{ post.excerpt }}并且在_config.yml中已设置

excerpt_separator: "<!-- more -->"

But on the page it's still displaying both the excerpt and body text. 但是在页面上,它仍然显示摘录和正文。

我看到了区别:

<!-- More --> != <!-- more -->

这个怎么样

{{ post.content | strip_html | truncatewords: 50 }}

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

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