Post

Migrating to Chirpy Theme: A Complete Guide (Jekyll + GitHub Pages + GitHub Actions)

Why and how I moved my Jekyll blog from an old theme to Chirpy — starter setup, post migration, front matter conversion, GitHub Pages configuration, and HTML Proofer troubleshooting.

Migrating to Chirpy Theme: A Complete Guide (Jekyll + GitHub Pages + GitHub Actions)

Overview

I recently migrated this blog from an old Jekyll theme to Chirpy. This post documents the whole process so you can do the same in a few hours — or use it as a reference later.

Here’s what I cover:

  1. What Chirpy is and why I chose it
  2. Migration plan at a glance
  3. Step-by-step migration
  4. GitHub Pages + GitHub Actions
  5. Configuration reference
  6. A new way to start a new post

The commands below are the exact ones I used. Adjust paths and names to your own repo.


1. What is Chirpy and why I chose it

Chirpy (jekyll-theme-chirpy) is a minimal, responsive, feature-rich Jekyll theme designed for technical writing. It is distributed as a Ruby gem, so your repo stays small — layouts, includes, and Sass live inside the gem, and you only keep content plus a few config files.

Why I moved:

FeatureWhat you get
Dark / light modeFollows system preference, with a toggle in the sidebar
Built-in searchFull-text search (simple-jekyll-search), no external service
Table of contentsAuto-generated per-post TOC — great for long, math-heavy posts
MathJax 3Faster than the MathJax 2 I had before; opt-in per post with math: true
PWAInstallable and offline-capable
Tags / Categories / ArchivesAuto-generated pages in the sidebar
ResponsiveMobile and tablet friendly out of the box

A hidden benefit: because Chirpy is built with GitHub Actions (not the classic GitHub Pages Jekyll build), you are no longer limited to GitHub’s plugin whitelist — you can use any Jekyll plugin you want.


2. Migration plan at a glance

My old site had 52 posts, a few custom pages, and several custom includes. The plan:

  1. Create a backup branch so I could roll back at any time.
  2. Replace the repo skeleton with the Chirpy starter.
  3. Migrate _posts/ and convert front matter.
  4. Rebuild custom pages (about, education, publications) as Chirpy tabs.
  5. Configure _config.yml (site info, GA4, Search Console, AdSense).
  6. Switch GitHub Pages to GitHub Actions and fix build issues.

Always create a backup branch first. A theme migration touches hundreds of files.


3. Step-by-step migration

3.1 Create a backup branch

1
2
3
git add -A
git commit -m "chore: checkpoint before theme migration"
git branch theme-backup

From now on, git checkout theme-backup restores the old site completely.

3.2 Get the Chirpy starter

The recommended starting point is chirpy-starter, a lightweight repo that uses the theme gem:

1
git clone --depth 1 https://github.com/cotes2020/chirpy-starter.git /tmp/chirpy-starter

Then copy its contents into your repo (keeping your .git, _posts/, img/, and ads.txt):

1
2
3
4
5
rsync -a \
  --exclude='.git' \
  --exclude='.gitmodules' \
  --exclude='assets/lib' \
  /tmp/chirpy-starter/ ./

3.3 Handle the assets/lib submodule

The starter declares assets/lib as a git submodule pointing to chirpy-static-assets. If you copy it naively, you end up with an embedded git repo inside your repo — which Git stores as a link, not real files.

The fix:

1
2
3
4
5
6
7
8
9
# fetch the actual asset files
git clone --depth 1 https://github.com/cotes2020/chirpy-static-assets.git /tmp/chirpy-assets

# copy them as plain files
mkdir -p assets/lib
rsync -a /tmp/chirpy-assets/ assets/lib/

# remove the nested .git so Git tracks them normally
rm -rf assets/lib/.git

If you already staged it by mistake and see 160000 (gitlink) in git ls-files -s assets/lib, force-untrack and re-add:

1
2
git rm -f --cached assets/lib
git add assets/lib

3.4 Migrate your posts

Copy _posts/ over. My old theme used different front matter keys, so I converted them with a small script:

Old (Hux theme)New (Chirpy)Notes
subtitle:description:shown as the post description / SEO meta
header-img:image:optional cover image
(global MathJax)math: trueopt-in per post

Example before:

1
2
3
4
5
6
---
layout: post
title: "DataTable"
subtitle: "withExamples"
tags: [data.table, R]
---

Example after:

1
2
3
4
5
6
7
---
layout: post
title: "DataTable"
description: "withExamples"
math: true
tags: [data.table, R]
---

layout: post is optional in Chirpy (its _config.yml defaults posts to that layout), but leaving it is harmless.

3.5 Rebuild custom pages as tabs

Chirpy renders sidebar “tabs” from the _tabs/ directory. Each file has an icon and an order:

1
2
3
4
5
6
7
8
---
icon: fas fa-book
order: 6
---

## Publication

...markdown content...

I converted my three custom pages:

  • about.html → _tabs/about.md
  • education.md → _tabs/education.md
  • publications.md → _tabs/publications.md

The built-in tabs (categories, tags, archives) come with the starter.

3.6 Configure _config.yml

Key settings I filled in:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
title: Yuan Blog
tagline: Exploring Science, Data, and Life
description: >-
  Exploring Science, Data, and Life – @Yuan's blog and digital notebook.
url: "https://raymondshang.github.io"

github:
  username: RaymondSHANG

social:
  name: Yuan Shang
  email: you@example.com
  links:
    - https://github.com/RaymondSHANG

webmaster_verifications:
  google: xBT4GhYoi5qRD5tr338pgPM5OWHHIDR6mNg1a3euekI

analytics:
  google:
    id: G-R27ZQFK0D4

avatar: /img/avatar-snowdesert.jpg
timezone: America/Los_Angeles
toc: true

3.7 Keep your old URLs

Chirpy’s default post permalink is /posts/:title/. My old site used “pretty” permalinks (/YYYY/MM/DD/title/), so I overrode it to avoid breaking existing links and search rankings:

1
2
3
4
5
6
7
defaults:
  - scope:
      path: ""
      type: posts
    values:
      layout: post
      permalink: /:year/:month/:day/:title/

3.8 Restore legacy includes

My old posts used custom includes — linksref.html, note.html, callout.html, and similar — so I restored those files under _includes/ and added a small CSS block (in _includes/metadata-hook.html, which Chirpy injects right before </head>) so the old alert/callout markup still renders nicely in both light and dark mode.


4. GitHub Pages + GitHub Actions

4.1 Switch the Pages source

This is the step most people miss. The classic GitHub Pages Jekyll build cannot build Chirpy, because the theme gem is not on GitHub’s whitelist. You must deploy via Actions:

  1. Push to main.
  2. Open your repo → Settings → Pages → Build and deployment → Source.
  3. Change Deploy from a branch to GitHub Actions.

4.2 The deploy workflow

The starter ships .github/workflows/pages-deploy.yml (“Build and Deploy”). It:

  1. Checks out the repo,
  2. Sets up Ruby 3.4,
  3. Runs bundle exec jekyll b -d "_site" (production),
  4. Runs HTML Proofer to validate links/images/scripts,
  5. Uploads the artifact and deploys to GitHub Pages.

You can trigger it again from the Actions tab with “Re-run all jobs”.

4.3 Troubleshooting HTML Proofer

This is where my first build failed. Two lessons:

Lesson 1 — non-HTTPS links. HTML Proofer 5.x enforces HTTPS by default (enforce_https: true). My old posts had plain http:// links, so the build failed with:

1
http://jekyllrb.com/ is not an HTTPS link

Fix the links to https:// where possible, or relax the check in the workflow:

1
2
3
4
5
run: |
  bundle exec htmlproofer _site \
    \-\-disable-external \
    \-\-no-enforce-https \
    \-\-ignore-urls "/^http:\/\/127.0.0.1/,/^http:\/\/0.0.0.0/,/^http:\/\/localhost/"

Use --no-enforce-https, not --enforce-https false. The latter passes false as a directory name and crashes with false does not exist (ArgumentError).

Lesson 2 — empty links. An empty Markdown link [text]() becomes <a href="">, which Proofer reports as “a” tag is missing a reference. Give it a real URL or remove the link.


5. Configuration reference

5.1 Frequently-used _config.yml keys

KeyPurpose
title / tagline / descriptionSite name, subtitle, SEO description
urlProtocol + hostname, no trailing slash
github.usernameUsed for the GitHub contact icon
social.name / social.email / social.linksAuthor name, email, social links
webmaster_verifications.googleGoogle Search Console verification code
analytics.google.idGA4 Measurement ID (e.g. G-XXXXXXXXXX)
avatarSidebar avatar image path
theme_modelight / dark / empty (follow system)
tocGlobal switch for post table of contents
pwa.enabledEnable installable PWA
paginatePosts per page
defaults → posts → permalinkPost URL pattern

5.2 Post front matter

1
2
3
4
5
6
7
8
9
---
title: "Post title"
description: "Short summary (used for SEO and preview)"
date: 2026-12-01
categories: [Blogging]
tags: [Jekyll, Chirpy]
math: true        # only if the post contains LaTeX
image: /img/cover.png   # optional cover image
---

5.3 Sidebar tabs

Create _tabs/<name>.md with icon and order:

1
2
3
4
5
6
7
---
icon: fas fa-graduation-cap
order: 5
---

## Education
...

5.4 Analytics and ads

  • GA4 — set analytics.google.id. Chirpy injects the script automatically.
  • Search Console — set webmaster_verifications.google.
  • AdSense — Chirpy has no native AdSense config. Inject the script via _includes/metadata-hook.html (a hook Chirpy renders before </head>) and keep ads.txt at the repo root.
1
2
3
<!-- _includes/metadata-hook.html -->
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXXXXX"
     crossorigin="anonymous"></script>

6. A new way to start a new post

The old theme had a Rakefile task that scaffolded a post for me:

1
rake post title="My Post" subtitle="A subtitle"

Chirpy doesn’t ship a rake task, so here’s the new workflow.

6.1 The manual way (no tools needed)

Create a file _posts/YYYY-MM-DD-slug.md and add front matter:

1
2
3
4
5
6
7
8
9
10
---
title: "My Post"
description: "A short summary (shown in previews and SEO meta)"
date: 2026-12-01
categories: [Blogging]
tags: [Jekyll, Chirpy]
math: true    # only if the post contains LaTeX
---

Your content here...

Then write the body in Markdown. That’s it.

6.2 Use jekyll-compose (the rake post equivalent)

If you miss the one-command scaffold, add jekyll-compose to your Gemfile:

1
gem "jekyll-compose", "~> 0.12"

These commands run on your machine, so you need Ruby and Bundler installed locally first. The repo pins Ruby 3.4 (see .ruby-version). Install it with your version manager — e.g. rbenv install 3.4.0 or brew install ruby@3.4 — then run bundle install once.

Then:

1
2
3
bundle exec jekyll post "My New Post"            # -> _posts/2026-12-01-my-new-post.md
bundle exec jekyll draft "My Draft"              # -> _drafts/my-draft.md
bundle exec jekyll publish _drafts/my-draft.md   # move a draft into _posts/

Because the site is built with GitHub Actions (not the classic Pages whitelist), extra plugins like this work out of the box.

6.3 Drafts and scheduling

  • Put unfinished posts in _drafts/ — they are not published.
  • A post with a future date stays hidden until that date arrives, which is perfect for scheduling weekly posts: write ahead, set a future date, and it goes live automatically.

Conclusion

Chirpy is a great fit for a technical blog: fast, responsive, dark-mode ready, and easy to maintain because the theme lives in a gem. The migration itself is mostly mechanical — backup, copy the starter, convert front matter, rebuild pages, and flip GitHub Pages to Actions.

The two things that cost me the most time were the assets/lib submodule and HTML Proofer’s HTTPS enforcement. Both are now documented above so you can avoid them.

Happy blogging! 🚀

This post is licensed under CC BY 4.0 by the author.