Here’s a cheat sheet for working with Jekyll, a static site generator:
Install Jekyll
gem install bundler jekyll
Create a New Jekyll Site
jekyll new site_name
Serve the Site Locally
cd site_name
bundle exec jekyll serve
# or
jekyll serve
Build the Site
bundle exec jekyll build
# or
jekyll build
Change Jekyll Configuration
Edit _config.yml
in the root directory.
Front Matter
Include YAML front matter at the top of Markdown files.
---
layout: default
title: Page Title
---
Create a New Page
Create a new Markdown file in the _posts
or any other directory.
Liquid Tags
Use Liquid tags for dynamic content.
{{ site.title }}
Include Files
Include files using {% include filename.html %}
.
Categories and Tags
Use categories and tags in front matter.
categories:
- category_name
tags:
- tag1
- tag2
Permalinks
Set custom permalinks in front matter.
permalink: /custom-url/
Layouts
Create custom layouts in the _layouts
directory.
Collections
Define collections in the configuration.
collections:
collection_name:
output: true
Pagination
Enable pagination in the configuration.
pagination:
enabled: true
Data Files
Create data files in the _data
directory.
Assets
Place stylesheets, scripts, and images in the assets
directory.
External Dependencies
Use plugins by adding them to the Gemfile
and running bundle install
.
GitHub Pages
For GitHub Pages, configure the repository settings.
Drafts
Create drafts in the _drafts
directory.
bundle exec jekyll serve --drafts
Custom Plugins
Create custom plugins in the _plugins
directory.
These commands and configurations cover some common tasks when working with Jekyll. For more details and advanced usage, refer to the official Jekyll documentation