Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Liquid tags in a Jekyll page, not a layout

Tags:

jekyll

liquid

I want to use liquid tags in a page on a Jekyll site. I have used them successfully in layout files, but when I use them in a page they are not parsed by Liquid.

The page is in html format not Markdown. The page has valid YAML front-matter that is being successfully used by the layout file. Here's the code for the page that isn't parsing:

---
layout: default
title: Media
id: media
order: 2
---
<section id="photos">
<h2>Photographs</h2>
<div id="galleries">
    {% for set in site.flickr-sets %}
    <div class="gallery" data-set="{{ set }}"></div>
    {% endfor %}
</div>
</section>

Is there any obvious reason why this isn't working? I really need to be able to access the site global variable...

EDIT

It seems this issue isn't confined to just that page. I tried creating a new page and using some liquid syntax and got the same result. It's also any liquid syntax not just tags.

In the layout file that these pages use I include the content of the page using {{ page.content }} rather than just {{ content }}. Could that be relevant?

like image 740
musoNic80 Avatar asked Jul 24 '13 18:07

musoNic80


1 Answers

{{ content }} works and it's different than {{ page.content }}

{{ content }} it's parsing all liquid syntax :)

Hope that helps.

like image 146
Pankaj Phartiyal Avatar answered Sep 23 '22 16:09

Pankaj Phartiyal