Jekyll Objects and Variables Quick Reference
Jekyll Objects Quick Reference
Site Variables
site.title
- Your site’s titlesite.description
- Site descriptionsite.url
- Site URLsite.baseurl
- Site base URLsite.time
- Current build timesite.pages
- All pagessite.posts
- All postssite.categories
- All categoriessite.tags
- All tags
Page Variables
page.title
- Page titlepage.date
- Page datepage.url
- Page URLpage.content
- Page contentpage.categories
- Page categoriespage.tags
- Page tagspage.excerpt
- Page excerptpage.next
- Next postpage.previous
- Previous post
Post Variables
post.title
- Post titlepost.date
- Post datepost.url
- Post URLpost.categories
- Categoriespost.tags
- Tagspost.content
- Contentpost.excerpt
- Excerpt
Common Filters
# Text
{{ "hello" | capitalize }}
{{ "hello" | upcase }}
{{ "HELLO" | downcase }}
# Arrays
{{ array | first }}
{{ array | last }}
{{ array | size }}
# Dates
{{ post.date | date: "%Y-%m-%d" }}
Usage Examples
List Posts
{% for post in site.posts %}
{{ post.title }}
{% endfor %}
Show Categories
{% for category in site.categories %}
{{ category[0] }} # Category name
{% for post in category[1] %}
{{ post.title }}
{% endfor %}
{% endfor %}
Navigation
{% for item in site.data.navigation %}
<a href="{{ item.url }}">{{ item.title }}</a>
{% endfor %}
Front Matter Template
---
layout: post
title: "Your Title"
date: YYYY-MM-DD
categories: [cat1, cat2]
tags: [tag1, tag2]
author: "Your Name"
excerpt: "Brief description"
---
Tips
- Use
site
for global info - Use
page
for current page - Use
post
in post loops - Categories/tags are arrays
- Always include front matter
- Use filters to format output
Common Tasks
Category Pages
{% for post in site.categories.your-category %}
{{ post.title }}
{% endfor %}
Related Posts
{% for post in site.related_posts limit:3 %}
{{ post.title }}
{% endfor %}
Date Formatting
{{ page.date | date: "%B %-d, %Y" }}
Includes with Parameters
{% include component.html param="value" %}
Remember:
- Use
{{ }}
for output - Use
{% %}
for logic - Front matter between
---
- Use proper date format
- Categories/tags in arrays
- Keep URLs clean