简体   繁体   English

Jekyll 帖子摘录:如何删除第一段

[英]Jekyll Post Excerpt: How to remove the first paragraph

I know how to use to define the end of the excerpt, but I'd like to omit the first paragraph of the post as well.我知道如何使用来定义摘录的结尾,但我也想省略文章的第一段。

How can this be done?如何才能做到这一点?

Thanks in advance all!提前谢谢大家!

Just got into the same issue.刚刚陷入同样的​​问题。 I have a separate place for excerpt and below I want post without excerpt (because it was already displayed).我有一个单独的摘录位置,下面我想要不带摘录的帖子(因为它已经显示了)。 What worked for me was:对我有用的是:

<header>
  {{ page.excerpt }}
</header>

<article>
  {{ content | remove_first:page.excerpt }}
</article>

It has to be defined in the same layout you use for posts and posts only.它必须在您用于帖子和帖子的相同布局中定义。

If I understand right you just want the first paragraph.如果我理解正确,您只需要第一段。

post.excerpt gets the first paragraph of your post. post.excerpt获取您帖子的第一段。 An alternative would be to create a variable in your markdown files and call it whenever you want.另一种方法是在 Markdown 文件中创建一个变量,并在需要时随时调用它。

eg例如

---
layout: post
title: Your title
post_description: A plugin to extend Swiper for easier JW Player integration.
---

and call {{ post.post_description }} in your lists.并在您的列表中调用{{ post.post_description }}

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

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