Hosting a Jekyll site on Netlify

How to deploy a Jekyll blog with GitHub and Netlify for a simple automated static-site workflow.

Hosting a Jekyll site on Netlify

What you’ll learn

  • How to prepare a Jekyll site for Netlify.
  • How GitHub and Netlify work together for automated deploys.
  • Which build files matter for a small static site.

This blog is built with the static site generator Jekyll (see last post). Static sites are easy, and usually free, to host.

Netlify is one of the services that offers convenient hosting options that can trigger a new build everytime you update a GitHub repository. This makes it easy to, for example, release a new blog post. You just push your changes to your repository and Netlify will make sure they are reflected on your hosted site.

First, you need to initiate the Ruby package manager, Bundler, in your project. If you are used to JavaScript, this is the Ruby equivalent of NPM, PNPM, or Yarn.

In the terminal, run:

> bundle init

And then:

> bundle install

You should now have a file named Gemfile.lock in the root of your project. This file will track all dependencies for your project.

Now you can go ahead and setup your GitHub repository and push the code there. Then you just have to register an account with Netlify (you can sign up using your GitHub account) and create a new site from your GitHub repository. The process once you’re on the Netlify dashboard is quite self-explanatory, but their docs here explain it in detail.

It’s a simple way to set up a site that you can update with a few simple commands. Build time on Netlify once you push updates to your repository is around a minute or so.

More From The Building this blog Series

Styled code blocks

Styled code blocks

How to style Jekyll code blocks with Rouge instead of leaving snippets to fend for themselves.

Jekyll Feb 12
JAMstack forms with Netlify

JAMstack forms with Netlify

How to add a small form to a static site using Netlify Forms without building a backend.

Deployment Jun 03
Getting started with Jekyll

Getting started with Jekyll

A beginner-friendly walkthrough for creating a static blog with Jekyll, Liquid, Markdown, and sim...

Jekyll May 20