我正在用 Jekyll 写博客。我知道 jekyll 有excerpt_separator可用于指定摘录的结尾,例如
This is a blog post, click to see more than this\n<!-- more -->\nThis is not in excerpt\nRun 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.\nRun Code Online (Sandbox Code Playgroud)\n到目前为止,我还无法找到支持这一点的证据。
\n我该如何完成这个任务?
小智 2
不幸的是,Jekyll 默认情况下不支持指定摘录开头的方法。
\n解决这个问题的一种可能方法是使用Jekyll 前面的变量,直接将所需的文本写入其中,然后在页面内容中excerpt显示变量的值。page.excerpt
它有点混乱,并且破坏了页面内容,但它会起作用。
\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.\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
591 次 |
| 最近记录: |