This page is not available in every language. Missing translations are disabled in the language selector.

Quick reference

Jekyll Static Site Generator Cheatsheet

A comprehensive reference guide for Jekyll: directory structure, YAML front matter, Liquid tags & filters, variables, collections, and GitHub Pages setup.

· Published

Jekyll is a blog-aware static site generator written in Ruby that powers GitHub Pages.

Directory Layout

├── _config.yml      # Global site configuration
├── _drafts/         # Unpublished draft posts
├── _includes/       # Reusable template partials
├── _layouts/        # Page and post layout wrappers
├── _posts/          # Published posts (YYYY-MM-DD-title.md)
├── _data/           # Structured JSON/YAML data files
├── _site/           # Built static HTML output
└── index.md         # Homepage entry file

YAML Front Matter

---
layout: post
title: "Announcing Version 2.0"
date: 2026-11-08 10:00:00 +0800
categories: news tech
tags: [release, ruby]
published: true
---

Liquid Template Syntax

Output & Variables

{{ site.title }}
{{ page.title }}
{{ content }}
{{ post.date | date: "%B %d, %Y" }}

Control Flow & Iteration

{% if page.comments %}
  {% include comments.html %}
{% endif %}

{% for post in site.posts limit:5 %}
  <h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
  <p>{{ post.excerpt }}</p>
{% endfor %}

Common Filters

Filter Description Example
date: "%Y-%m-%d" Format timestamp {{ page.date | date: "%Y" }}
truncate: 100 Truncate string with ellipsis {{ post.content | truncate: 100 }}
strip_html Strip all HTML markup {{ post.content | strip_html }}
jsonify Serialize data to JSON string {{ site.data.authors | jsonify }}
markdownify Convert Markdown to HTML {{ text | markdownify }}

Global Variables Reference

  • site.posts: Reverse-chronological list of all posts.
  • site.pages: List of all static pages.
  • site.html_pages: Subset of site.pages that output HTML.
  • site.data: Raw data loaded from _data/*.yml files.
  • site.time: The current build generation timestamp.

References

Related topics