Welcome to this beginner-friendly tutorial on Jekyll, a powerful static site generator that’s perfect for building blogs, personal websites, and more!
Jekyll is a free and open-source tool that takes your content written in Markdown (or other formats) and uses templates to generate static HTML, CSS, and JavaScript files. This means you get a fast, secure, and easily hostable website without the need for server-side processing.
Key Advantages of Jekyll:
Before we begin, make sure you have the following installed:
gem install bundlerInstall the Jekyll gem using the following command:
1
gem install jekyll bundler
This may take a few moments.
cd command in your terminal.Run the following command to create a new Jekyll project named “my-jekyll-site”:
1
jekyll new my-jekyll-site
Now change directory into the folder you just created
1
cd my-jekyll-site
Let’s take a look at the key files and folders created by Jekyll:
_config.yml: The configuration file for your website. Here you set things like the site title, theme, and other settings._posts: This folder contains your blog posts. Each post should be a Markdown file with a specific naming convention (e.g., YYYY-MM-DD-your-post-title.md).index.html: The main landing page for your site (usually uses Liquid templating).Gemfile and Gemfile.lock: These files are used by Bundler to manage your project’s dependencies.Inside your project directory, run the following command:
1
bundle exec jekyll serve
Jekyll will start a local server. Open your web browser and go to http://localhost:4000. You should see your new Jekyll website!
_posts folder, create a new file named 2023-10-27-my-first-post.md.Open the file in your text editor and add the following content:
1
2
3
4
5
6
7
8
9
10
---
title: "My First Blog Post!"
date: 2023-10-27
---
# Hello World!
This is my first blog post using Jekyll. How exciting!
I'm learning how to use Markdown and build static websites. It's fun.
http://localhost:4000 will reflect these changes._config.yml: Change the title, description, and other settings.index.html: Customize your home page using HTML and Liquid templating._posts directory.Congratulations! You’ve created your first Jekyll site and blog post. This is just the beginning; Jekyll offers endless possibilities for customization and expansion. Continue experimenting, and refer to the official Jekyll documentation for more details.
Happy blogging!