Questions tagged [liquid]

Liquid is an open-source template language created by Shopify and written in Ruby. It is the backbone of Shopify themes and is used to load dynamic content on storefronts. Liquid has been in production use at Shopify since 2006 and is now used by many other hosted web applications.

Liquid is a templating engine for creating web pages. From the Liquid website:

Liquid is an extraction from the e-commerce system Shopify. Shopify powers many thousands of e-commerce stores which all call for unique designs. For this we developed Liquid which allows our customers complete design freedom while maintaining the integrity of our servers.

Liquid has been in production use since June 2006 and is now used by many other hosted web applications.

It was developed to for usage in Ruby on Rails web applications and integrates seamlessly as a plugin but it also works excellently as a stand alone library.

In addition, Liquid is also used as the main templating engine on GitHub pages through the Jekyll static site generator.

3995 questions
119
votes
5 answers

Escaping double curly braces inside a markdown code block in Jekyll

I'm using Jekyll to create a documentation site wherein I am trying to document some code that contains handlebars-like syntax. For example {{foo}}. The problem is that Jekyll uses liquid tags and no matter what I do, my double curlies are getting…
rescuecreative
  • 3,607
  • 3
  • 18
  • 28
112
votes
6 answers

How does Jekyll date formatting work?

I'm using Jekyll to generate a simple site. I want the date field to display in the format 12 September 2011. I've found, through some creative googling, a bit of date-format manipulation, but nothing that seems to get me the month name. What I have…
Michael
  • 1,257
  • 2
  • 9
  • 7
104
votes
9 answers

How to escape liquid template tags?

This sounds very easy, however I couldn't find it anywhere in the docs. How can I write {% this %} in a liquid template, without it being processed by the engine?
Attila O.
  • 15,659
  • 11
  • 54
  • 84
83
votes
6 answers

How do you comment out in Liquid?

What is the correct way to comment out in the Liquid templating language?
Martin Buberl
  • 45,844
  • 25
  • 100
  • 144
80
votes
3 answers

How to concatenate / append a string to another one in Jekyll / Liquid?

To be clear, assuming: {% assign my_var = "123" %} {% assign another_var = "456" %} I would like to append string to my_var to get something like 123 - 456 What I have tried so far: {% assign my_var = my_var + " - " + another_var %}
AsTeR
  • 7,247
  • 14
  • 60
  • 99
73
votes
4 answers

Get today's date in Jekyll with Liquid markup

This (should) be easy, I think, but I'm unable to get today's date to show in a Jekyll page using Liquid markup. According to the documentation, I should be able to do this to get this date's year: {{ 'now' | date: "%Y" }} But all that gets…
Jeff Pratt
  • 1,619
  • 1
  • 13
  • 21
71
votes
2 answers

Does Liquid have a "does not contain" or "not in array" operator?

When calling items from an array in a Liquid template, how do you call does not contain or not in array?
mike
  • 1,786
  • 2
  • 19
  • 31
69
votes
10 answers

Sorted navigation menu with Jekyll and Liquid

I'm constructing a static site (no blog) with Jekyll/Liquid. I want it to have an auto-generated navigation menu that lists all existing pages and highlight the current page. The items should be added to the menu in a particular order. Therefore, I…
flyx
  • 35,506
  • 7
  • 89
  • 126
67
votes
4 answers

Passing parameters to inclusion in Liquid templates

On my Jekyll-powered website I have an inclusion that does something function-like, but I can't figure out how to pass it parameters correctly. When I use {% include ... %}, passing parameters like this.. {% include function.liquid foo="{{ baz.quux…
Nick
  • 2,662
  • 2
  • 25
  • 48
58
votes
3 answers

Iterate over hashes in liquid templates

I'm writing a site in Jekyll, which uses Liquid. I have front matter for pages that I'd like to look like this: --- title: Designing algorithms that scale horizontally speaker: Luke Ehresman, CopperEgg category: notes.mongodallas.talks links: -…
Brian Hicks
  • 6,213
  • 8
  • 51
  • 77
57
votes
6 answers

Jekyll display posts by category

scratching my head over this - help much appreciated. I want to display a list of all my Jekyll posts, organised by category. I know Line 3 isn't correct but I can't figure out what it should be. Any ideas? Thanks! {% for category in…
Alex G
  • 1,646
  • 2
  • 17
  • 19
56
votes
1 answer

Jekyll/Liquid - how to add large blocks of text to YAML front matter?

I'm trying to implement a service catalog in Jekyll, in which each of 20 or 30 pages will contain a 7x2 table. The left column will hold labels, e.g. Overview, Available To, etc, while the right column will hold between one line and several…
patrickjmc
  • 569
  • 1
  • 4
  • 3
55
votes
2 answers

Convert string to integer in Shopify Liquid?

I just read this related answer: How can I convert a number to a string? - Shopify Design — Ecommerce University To convert a string to a number just add 0 to the variable: {% assign variablename = variablename | plus:0 %} Not super elegant but it…
MountainX
  • 6,217
  • 8
  • 52
  • 83
55
votes
8 answers

Jekyll/Liquid Templating: How to group blog posts by year?

I'm rewriting my blog to use Jekyll. Jekyll uses the Liquid templating language so it makes it a little more difficult to learn how to customize. I'd like to group my list of blog posts by year. How would I write the Liquid code to be able to do…
Andrew
  • 227,796
  • 193
  • 515
  • 708
1
2 3
99 100