我在和杰基尔写博客。我知道jekyll有一个excerpt_separator,它可以用来指定一个节选的结尾,比如
This is a blog post, click to see more than this
<!-- more -->
This is not in excerpt然而,我想开始我的每个博客文章的引文,但不包括在节选。有点像
> “There are two ways of constructing a software design: One way is to make it
> so simple that there are obviously no deficiencies and the other way is to
> make it so complicated that there are no obvious deficiencies.” – C.A.R. Hoare
<!-- begin_excerpt -->
This is the excerpt
<!-- end_excerpt -->
Not part of the excerpt.到目前为止,我还没有找到证据证明这是有根据的。
我该怎么做才能做到这一点?
发布于 2020-08-12 14:12:08
不幸的是,Jekyll在默认情况下并不支持一种指定摘录开始的方法。
解决这个问题的一种可能方法是在Jekyll的前端使用excerpt变量,直接将所需的文本写入其中,然后在页面内容中显示page.excerpt变量的值。
这是有点凌乱,并打破了页面内容,但它会工作。
---
excerpt: 'This is the excerpt'
---
> “There are two ways of constructing a software design: One way is to make it
> so simple that there are obviously no deficiencies and the other way is to
> make it so complicated that there are no obvious deficiencies.” – C.A.R. Hoare
{{ page.excerpt }} // This is the excerpt
Not part of the excerpt.发布于 2020-08-23 03:22:04
我找到了另一种可行的方法,不应该破坏预期的行为。我发现如果你把引号移到前面,并改变你的布局,你可以让摘录忽略引号。
样本职位:
---
title: Test of Quote Post
layout: quotepost
categories: Random
comments: false
quote: |
Hack the Planet!
Hack the Planet!
---
A sample post preceded by a quote.版面部分:
{% if page.quote %}
<p class="lead">{{ page.quote | markdownify }}</p>
{% endif %}
<p class="lead">{{ content }}</p>这是因为引文不再是帖子内容的一部分。但是,posts布局将在文章内容之前将引号添加到页面布局中。你甚至可以用这种方式引用他们自己的风格属性。这也是如何向不属于内容的页面添加功能(如注释)。
注:如果你想在单行上加一个双空格,你就必须在引号的每一行后面加一个双空格。另外,如果您想让整个文章内容显示在另一个页面上,如果需要的话,您必须手动地包含引号。
https://stackoverflow.com/questions/63368224
复制相似问题