Jekyll YAML问题渲染“”

时间:2015-08-03 09:38:30

标签: jekyll

我正在写一些Jekyll,这是我的标签:

---
layout: post
title: Running off the path into programming ... a gag-inducing excerpt from one of my B-school essays.
date: '2015-01-10T13:41:00+01:00'
tags:
- random
tumblr_url: http://www.iamthemangosteen.com/post/107708808069/running-off-the-path-into-programmingan-excerpt
excerpt: <p> ...But I was tired that day. I was tired of losing, tired of following my captain's juvenile policy of punishment runs, and tired of myself for lacking the curiosity to explore my beautiful campus and the surrounding forests. And so I ran off the path and after several miles of Berkshire forest, I entered the clearing of my college’s best kept secret our very own wildlife and bird sanctuary. I spent the rest of my afternoon discovering...</p>
---

我想在标题和摘录引号周围加上引号,除了“”似乎在网站中根本不呈现并且似乎抛出错误。我该怎么做来代表html文件的YAML部分中的引号? 如何在摘录中显示引号?

1 个答案:

答案 0 :(得分:2)

有几件事:

  1. 您应该可以使用单个'或双引号",但不能使用引号“”。如果你的字符串中没有逗号,你也应该没有引号。
  2. 如果您在excerpt_separator中定义并使用_config.yml,系统会自动为您生成post.excerptJekyll Docs - Posts
  3. 您不需要将HTML传递到任何前端问题。您只需使用strip_htmlmarkdownify过滤器调用它即可剥离链接/格式并将其包装在<p>标记中。 Jekyll Docs - Templates
  4. {{ page.excerpt|strip_html|markdownify }}

    编辑:我可能有误读,但是要在其中一个前面的内容中加上引号,你可以使用反斜杠来逃避它:

    ---
    title: "This is a quote \" it is rendered."
    ---