在Jekyll页面中使用Liquid标签无法正常工作

nVe*_*lia 16 ruby git liquid jekyll

我正在尝试使用Jekyll设置一个小博客.到目前为止,我的工作如下.

  • 设置Github页面存储库
  • 克隆了当地的回购
  • 安装Ruby vs 2和sdk(windows)
  • 安装了杰基尔
  • '服务'本地网站.
  • 验证我可以查看我的网站localhost:4000

一切正常,但液体语法不能按预期工作.所有语法都作为平面文本输出.我不知道如何继续.此错误在本地以及我的github托管页面上都会发生.

这是我的index.html文件

<!DOCTYPE html>
<html lang="en-us">
<head>
  {% include meta %}{{ site.time | date_to_xmlschema }}
</head>
<body>
  {% include header.html %}
  {% include header.html %}
  {% include header.html %}
  {% foo %}
  {{ foo }}

  <section class="main-content">
    {% include footer.html %}
  </section>
  {% include scripts.html %}
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我的_config.yml定义了foo.=(

Dav*_*uel 28

如果您希望Jekyll处理您的页面,您必须在页面中添加Front事项(请参阅Jekyll文档中的专用页面).

最小的前端是空的.这意味着您的页面将使用默认配置进行布局等.

---
# this is an empty front matter
---
Your content here
Run Code Online (Sandbox Code Playgroud)

  • 您可以将此代码块放在 html 文件的顶部。 (2认同)
  • 这次真是万分感谢。官方的循序渐进的Jekyll简介不包括此重要细节。https://jekyllrb.com/docs/step-by-step/02-liquid/ (2认同)