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
28
votes
2 answers

Liquid markup to detect current page URL?

I've just recently started using Github to host my blog (using Jekyll and Liquid). However, I'm having an issue which I can't currently fix. The issue could be hacked/solved if I was able to detect which "page" or "url" the user was…
user623990
28
votes
4 answers

Using filters in Liquid tags

I'm using jekyll and Liquid to generate a static web site on github pages. I want to base some content decisions on whether the amount of content in a document has reached a specific number of works. jekyll has a liquid filter which counts the…
drekka
  • 20,957
  • 14
  • 79
  • 135
28
votes
9 answers

Locale specific date in jekyll

I am trying out jekyll for website creation. I am using jekyll-bootstrap. The default configuration has the page archive, where all the posts are listed grouped by year and month of the post date. Currently the months appear in English. I've looked…
mpiktas
  • 11,258
  • 7
  • 44
  • 57
27
votes
5 answers

In Jekyll How do I grab a post's first image?

In my index of blog posts I'd like to grab the first image from the post to display it in the index using just liquid so it works on github pages. I have a feeling split is the way to go, but I'm not good with liquid. I'd like to be able to get the…
David Silva Smith
  • 11,498
  • 11
  • 67
  • 91
27
votes
2 answers

Date Math / Manipulation in Liquid Template Filter

I'm constructing an "Integration URL" in Desk.com, which uses the Shopify Liquid Template filter syntax. This URL needs to contain a "start date" and an "end date" for a query where the start date is 7 days ago and the end date is right now. To…
jonaz
  • 2,096
  • 1
  • 17
  • 30
26
votes
7 answers

Using liquid to sort posts alphabetically

Is there a way to sort a number of posts alphabetically, using Jekyll? I have something like this now: {% for post in site.categories.threat %}
  • {{ post.title }}
  • {% endfor %} It works, but the posts are jumbled…
    Jacques Tardie
    • 567
    • 2
    • 10
    • 16
    26
    votes
    9 answers

    For loop, wrap every two posts in a div

    Basically, I am using Jekyll (which uses the Liquid templating language) and I am trying to write a for loop which wraps every two items in a div. This is my current loop:
    {% for post in site.posts %} {{…
    Tom
    • 825
    • 2
    • 11
    • 22
    26
    votes
    6 answers

    How do I retrieve a specific product in Shopify Liquid?

    I have a list of product handles, and I want to fetch the product based on this handle. It seems there is no way to tell Liquid to go and get a single product. I could do this with the API, but if I use the API then I have to use JavaScript, and I…
    jayshields
    • 395
    • 1
    • 3
    • 9
    24
    votes
    2 answers

    Can Jekyll act over css or js files?

    I'm using Jekyll for one of my projects and it really seems a very good alternative for developing simple websites but maintaining some processes automated. It's nice how the Liquid Extensions work, so I was wondering if it's possible to make Jekyll…
    zanona
    • 12,345
    • 25
    • 86
    • 141
    24
    votes
    3 answers

    How to create an array in a for loop in Liquid?

    I'm trying to create an array from a list of objects using Liquid syntax: {% for operation in menuItems %} {% assign words1 = operation.Title | split: '_' %} {% assign controllerName = words1 | first %} {% assign controllersTmp =…
    Maroine Abdellah
    • 576
    • 1
    • 5
    • 21
    24
    votes
    5 answers

    How to suppress blank line in Jekyll?

    I use GitHub Pages for my blog, and am running into a problem with Jekyll. My post.html has a block like this: {% for testpost in site.posts %} {% four %} {% lines of %} {% processing …
    James Curran
    • 101,701
    • 37
    • 181
    • 258
    24
    votes
    4 answers

    How do I use markdownify in Jekyll to show an excerpt on the index

    I'm looking to show a short excerpt of text from a longer post or page on the index page. I was going to use a custom variable in the Front Matter and grab that, but then I saw the filter for .excerpt I see in the Jekyll docs there's something…
    kaplan
    • 4,109
    • 6
    • 30
    • 35
    23
    votes
    1 answer

    Print_r equivalent in Liquid

    In Liquid, how can I find out all the values that a collection contains? Is there a print_r function or similar? The example below will return the item title, but I would like to know what other variables item also holds. item.title Thanks.
    addedlovely
    • 3,076
    • 3
    • 22
    • 37
    23
    votes
    7 answers

    Modulus (or lack thereof) in Ruby's Liquid templating engine

    I'm working on a Jekyll site and am trying to output three column divs nested in a row div. Liquid makes this pretty easy with their cycle filter: {% for p in site.categories.post %} {% cycle 'add rows': '
    ', nil, nil %} …
    Andrew
    • 36,541
    • 13
    • 67
    • 93
    23
    votes
    8 answers

    Capitalize first letter of each word with liquid syntax?

    I am trying to set up SEO in a LocomotiveCMS installation using liquid syntax. I'm trying to code it so that the page title is pulled dynamically using {{ page.title }} and then forcing it to capitalize the first letter of each word. I tried…
    APAD1
    • 13,509
    • 8
    • 43
    • 72