Liquid

🌿 |

One of the Lessons from Building this Site is picking up a general familiarity with Liquid, which according to their site is

an open-source template language created by Shopify and written in Ruby

I know all of those words separately, but in that string, not so much. Nevertheless! Jekyll (which runs this blog) uses liquid for variables and conditionals, which are super useful.

General notes to myself

  • stop forgetting to put the second % at the end of the brackets.

  • the whole site will kinda break when you’ve messed some liquid up. Don’t panic, just scroll up in the terminal and find the bug it identifies.

  • all functions that come after a | get a colon before the argument

Variables

Liquid is mostly useful because it’s got all sorts of info stored within little libraries like notes and pages. For example:

{{note.title}} will give the titles of pages, and helps to format things in layouts which determines, you guessed it, the layout of certain types of pages

{{note.url}} will give the link to a note

`` is pretty nifty as well, but it’s more useful when you append the date: function, which allows you to format things a bunch of different ways

Conditionals and loops


Liquid’s documentation

One source for the string-to-number trick

A great calculator for the funky date-time formatting.

A liquid search function that I’d like to play with at some point

Notes mentioning this note


📬 Send me your thoughts on this note! 📬