How to Create a Static Site with Jekyll: A Step-by-Step Guide
Jekyll is a powerful static site generator that transforms plain text into fast, secure, and easily deployable websites. It’s the engine behind GitHub Pages and perfect for blogs, portfolios, or documentation sites. With no database and simple file-based content, you get full control over your site’s performance and structure.
Before you start, ensure Ruby (version 2.5 or higher) is installed on your system. Open your terminal and install Jekyll and Bundler with gem install jekyll bundler. That’s all you need for the base setup.
Setting Up a New Jekyll Project
Create a new Jekyll site by running:
jekyll new my-site– generates a default folder structure.cd my-site– navigate into your project.bundle exec jekyll serve– starts a local server athttp://localhost:4000.
Edit _config.yml to change your site title, description, and URL settings. All changes appear instantly in the browser.
Creating Pages and Posts
Content lives in Markdown files with YAML front matter. Add a new post:
- Create
_posts/2025-03-20-my-first-post.mdwith a header like--- layout: post title: "Hello World" ---. - For pages, add
about.mdin the root withlayout: page. - Jekyll automatically converts Markdown to HTML and includes it in the navigation.
Customizing Layouts and Themes
Modify the look of your site via _layouts and _includes folders. To apply a theme:
- Add a gem like
gem "minima"to your Gemfile if not already present. - Run
bundle installand settheme: minimain_config.yml. - Override theme files by placing your own versions (e.g.,
_layouts/default.html).
Building and Deploying Your Site
When ready, generate a production build:
- Run
bundle exec jekyll build– outputs static files to the_sitefolder. - Deploy that folder to any host: GitHub Pages (push to
gh-pagesbranch or adocs/folder), Netlify, or any static server. - For GitHub Pages, simply push your main branch and enable Pages in the repo settings.
Jekyll gives you a lightweight, blog-ready website in minutes. Start with a default theme, add posts and pages, then customize as you grow. Its simplicity makes it a favorite for developers and writers alike.