首页 文章

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

提问于
浏览
8

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

  • 设置Github页面存储库

  • 在本地克隆了回购

  • 安装Ruby vs 2和sdk(windows)

  • 安装了jekyll

  • 'serve'本地网站 .

  • 验证我可以查看我的网站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>

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

1 回答

  • 19

    如果您希望Jekyll处理您的页面,您必须在页面中添加Front事项(see dedicated page in Jekyll documentation) .

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

    ---
    # this is an empty front matter
    ---
    Your content here
    

相关问题