Date formatting

Format a date by appending a date filter to your variable like this:

  {{post.date | date: '%Y %B %d' }}

Here are the docs and here’s a handy reference on the %placholders.

String concatenation

Method #1

Use assign:

  {% assign new_var = var_first | append: ' - ' | append: var_second %}

Method #2

Use capture:

  {% capture new_var %}{{ var_first }} - {{ var_second }}{% endcapture %}

Data structures

Instantiate an empty array

In your _config.yml add a variable like:

emptyArray: []

Then in your Liquid template do:

  {% assign my_array = site.emptyArray %}

Source

Push data into an array

  {% assign my_array = my_array | push: '<value>' %}

Source

Get an object by ID

The ID of any posts or collection item in Jekyll will be its filename. This is what you see in the URL as the item’s path (not including parent paths). Example: about-us for a file called about-us.md.

  {% assign post = site.posts | where: "id", <item_id> | first %}

Source

Kickstarter Coming January

I'm launching a board game called Delivery Duck. You're a duck, in a truck, delivering packages. It's a strategic family game for 2 to 6 players.

Check out the board game!