Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 383
sunnyrjuneja Avatar asked Oct 27 '25 18:10

sunnyrjuneja


1 Answers

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 }}
like image 134
Christian Specht Avatar answered Oct 30 '25 08:10

Christian Specht