How to generate a static site with Jekyll
Screenshot generated using

How to generate a static site with Jekyll

Written by Pranav Chakkarwar on 06 Jan 2022 • 5 minutes to read

Jekyll is a static site generator

A static site generator creates a static HTML website from a template and raw data. In essence, it automates the job of generating and maintaining individual HTML pages and prepares them for serving to users ahead of time. A static site is ideal for something like a blog, where the material doesn’t need to be updated frequently. We can use a content delivery network to cache the site, thus storing a copy of it on hundreds of servers around the world. The CDN can then offer the site to any user from the server that is closest to them. This helps us save money on servers while allowing users to access the site faster.

Jekyll is my choice because it claims to be “blog-aware”, offering features that will make it easier for us to maintain our code and keep the blog running smoothly. It also offers hundreds of community-created plugins, including as an RSS feed generator, a sitemap generator, an admin panel, among others. I assume you have some basic knowledge of HTML, CSS, and JS as I cannot cover that here.

Create a new site with jekyll

Here are some important ones.


What are these files and folders?

Create some for pages for your blog

My blog features an index.html page with information about me and the latest blog entries, a blog page with all the posts, a contribute page where you may support my selfless work, a contact page with my end-to-end encrypted contact form, and a search page to search through all the published articles. Once your site is built, you can use the name of the file to visit these pages. In the case of my blog; contact.html is available at and contribute.html at You’re free to make as many of these files as you’d like.


Each page will use the data defined in default.html of the _layouts folder, unless you specify otherwise. Jekyll uses YAML to customize the title, description, meta image, layout, and any other metadata for each of all pages. An example YAML of my index.html page is shown below.

title: Pranav Chakkarwar
description: I'm a minimalist writing on privacy...
layout: default
image: /images/metaimg.webp

To make a page available at a different URL than its file’s name, use permalink in your YAML. The YAML below will make a page available at, regardless of the page’s name.

title: A new page
description: Just a page
layout: default
image: /images/image-name.webp
permalink: custom-url

Finally, build your website

To build your site jekyll uses some commands that must be typed into the terminal of the folder containing your website. The jekyll build command will build your site using the layouts, config.yml customizations, YAML in individual pages, and export it to the _site folder. You can serve the _site folder locally using the jekyll serve command, and your site will be available at localhost:4000 through your browser.

This _site folder contains all the files you’ll need to launch your website using a CDN, like Netlify. There is, however, more work to be done ;)

Enjoyed this article?

Get interesting articles in your Inbox 📨


Post a comment

Comments will be approved manually and will take time to reflect.

You may also Enjoy

Crafting a minimal, fast and yet a feature-rich blog (Introduction)

Crafting a minimal, fast and yet a feature-rich blog (Introduction)

Published on 24 Nov 2021 • 5 minutes to read

Build your identity on the internet using a blog and share your ideas. The internet is open and w... Read more →
Facebook isn't filtering photos, but thoughts

Facebook isn't filtering photos, but thoughts

Published on 29 Oct 2021 • 15 minutes to read

Do you wake up to hate speech, misinformation, and disinformation every day? Are you inclined to ... Read more →
Designing an End-to-End-Encrypted contact form with OpenPGP.js

E2EE Contact Form for a website

Published on 01 Sep 2021 • 13 minutes to read

An end-to-end-encrypted contact will allow communications to stay between a user and you. Email o... Read more →
A simple and effective guide to online privacy

A guide to online privacy

Published on 17 Jul 2021 • 5 minutes to read

Protecting our privacy online tends to be especially important nowadays, but arguing won't solve ... Read more →