sunnyrjuneja
sunnyrjuneja

Reputation: 6123

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.

My current directory structure looks like

_layouts
  page.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 }}.

Upvotes: 4

Views: 1527

Answers (1)

Christian Specht
Christian Specht

Reputation: 36421

You don't show us where and how you defined 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:

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 (e.g., not in the front-matter):

Declaration:

{% assign foo = 'whatever' %}

To display it on the page:

{{ foo }}

Upvotes: 4

Related Questions