Jekyll 开始 * 和 * 结束摘录分隔符

far*_*121 5 markdown jekyll

我正在用 Jekyll 写博客。我知道 jekyll 有excerpt_separator可用于指定摘录的结尾,例如

\n
This is a blog post, click to see more than this\n<!-- more -->\nThis is not in excerpt\n
Run Code Online (Sandbox Code Playgroud)\n

不过,我想在每篇博文的开头引用一句话,但不要在摘录中包含该引用。就像是

\n
>   \xe2\x80\x9cThere are two ways of constructing a software design: One way is to make it\n>   so simple that there are obviously no deficiencies and the other way is to\n>   make it so complicated that there are no obvious deficiencies.\xe2\x80\x9d \xe2\x80\x93 C.A.R. Hoare\n\n<!-- begin_excerpt -->\nThis is the excerpt\n<!-- end_excerpt -->\n\nNot part of the excerpt.\n
Run Code Online (Sandbox Code Playgroud)\n

到目前为止,我还无法找到支持这一点的证据。
\n我该如何完成这个任务?

\n

小智 2

不幸的是,Jekyll 默认情况下不支持指定摘录开头的方法。

\n

解决这个问题的一种可能方法是使用Jekyll 前面的变量,直接将所需的文本写入其中,然后在页面内容中excerpt显示变量的值。page.excerpt

\n

它有点混乱,并且破坏了页面内容,但它会起作用。

\n
---\nexcerpt: 'This is the excerpt'\n---\n\n>   \xe2\x80\x9cThere are two ways of constructing a software design: One way is to make it\n>   so simple that there are obviously no deficiencies and the other way is to\n>   make it so complicated that there are no obvious deficiencies.\xe2\x80\x9d \xe2\x80\x93 C.A.R. Hoare\n\n{{ page.excerpt }} // This is the excerpt\n\nNot part of the excerpt.\n
Run Code Online (Sandbox Code Playgroud)\n