简体   繁体   English

Jekyll HTML页面未呈现液体

[英]Jekyll HTML Page Not Rendering Liquid

I'm currently using jekyll to build a static site and it appears that the HTML files are not parsing liquid. 我目前正在使用jekyll来构建静态网站,并且看来HTML文件无法解析液体。

My current directory structure looks like 我当前的目录结构如下所示

_layouts
  page.html
index.html

index.html: index.html:

---
layout: page
title: home
---

{{ foo }}

When I visit http://host/index.html , the layout is applied as expected but the page doesn't evaluate {{ foo }} but instead prints the string {{ foo }} . 当我访问http://host/index.html ,布局将按预期应用,但页面未评估{{ foo }} ,而是打印字符串{{ foo }}

You don't show us where and how you defined foo . 您没有告诉我们您在哪里以及如何定义foo

There are several possible ways how to do that...and for each one, the syntax to display the value is slightly different: 有几种可能的方法...每种方法的显示值语法略有不同:


In _config.yml : _config.yml中

Declaration: 宣言:

foo: whatever

To display it on the page: 要将其显示在页面上:

{{ site.foo }}

In the front-matter of the same page: 在同一页面的最前面

Declaration: 宣言:

---
foo: whatever
---

To display it on the page: 要将其显示在页面上:

{{ page.foo }}

In the body of the same page (eg, not in the front-matter) : 在同一页的正文中(例如, 不在最前面)

Declaration: 宣言:

{% assign foo = 'whatever' %}

To display it on the page: 要将其显示在页面上:

{{ foo }}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM