クイックリファレンス

Jekyll 静的サイトジェネレーター チートシート

Ruby 製静的サイトジェネレーター Jekyll の総合リファレンス:ディレクトリ構成、YAML Front Matter、Liquid タグ/フィルター、グローバル変数、GitHub Pages 設定を網羅。

· 公開日

Jekyll は GitHub Pages を支える、Ruby 製のブログ対応静的サイトジェネレーターです。

ディレクトリ構成

├── _config.yml      # サイト全体の設定ファイル
├── _drafts/         # 未公開の下書き記事
├── _includes/       # 再利用可能なテンプレートパーツ
├── _layouts/        # ページ・記事のレイアウトラッパー
├── _posts/          # 公開記事 (YYYY-MM-DD-title.md)
├── _data/           # 構造化 JSON/YAML データファイル
├── _site/           # ビルド済み静的 HTML 出力先
└── index.md         # ホームページのエントリーファイル

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 テンプレート構文

出力と変数

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

制御構文とループ

{% 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 %}

よく使うフィルター

フィルター 説明 例
date: "%Y-%m-%d" 日時フォーマット整形 {{ page.date | date: "%Y" }}
truncate: 100 指定文字数で切り詰めて省略記号を付与 {{ post.content | truncate: 100 }}
strip_html すべての HTML タグを除去 {{ post.content | strip_html }}
jsonify データを JSON 文字列へシリアライズ {{ site.data.authors | jsonify }}
markdownify Markdown を HTML に変換 {{ text | markdownify }}

グローバル変数リファレンス

  • site.posts: 全投稿記事の新しい順リスト。
  • site.pages: すべての静的ページのリスト。
  • site.html_pages: site.pages のうち HTML 出力されるもののサブセット。
  • site.data: _data/*.yml から読み込まれた生データ。
  • site.time: 現在のビルド生成タイムスタンプ。

参考リンク

関連テーマ