jekyllrb.comに従ってJekyllを動かしてみることにしました。

雛形を作ってもらう

$ mkdir x
$ cd x
$ rbenv local 4.0.1
$ bundle init
$ bundle add jekyll
$ bundle add logger
$ bundle exec jekyll new zunda.github.io
$ cd zunda.github.io
$ rbenv local 4.0.1
$ bundle add logger
$ bundle exec jekyll serve

いくつか警告が表示されるけれども http://127.0.0.1:4000/ で雛形が見えました。ここまでの状態を記録しておきます。

$ git init
$ git add .gitignore .ruby-version 404.html Gemfile Gemfile.lock _config.yml _posts/2026-01-14-welcome-to-jekyll.markdown about.markdown index.markdown
$ git commit -m 'Initial commit'

自分好みにする

記事ファイルの拡張子

拡張子は.markdownよりも.mdが好み。

$ git mv index.markdown index.md
$ git mv about.markdown about.md
$ git mv _posts/2026-01-14-welcome-to-jekyll.markdown _posts/2026-01-14-welcome-to-jekyll.md
$ git commit

全体的な設定

_config.ymlを編集します。kramdownを使ってみます。

$ bundle add kramdown
$ vi _config.yml

_config.ymlに下記のような行を追加しました。

markdown: kramdown
kramdown:
  input: GFM
  hard_wrap: false
  syntax_highlighter: rouge
  autolink: true

このサイトについても編集します。

$ vi about.html

記事

このメモを最初の記事にします。

$ vi _posts/2026-01-14-welcome-to-jekyll.md

ここまでの作業を記録しておきます。

$ git commit -a

GitHub Pagesで公開する

GitHub Pages documentationに従って公開してみます。

僕のGitHubアカウントではこれまで別のレポジトリをGitHub Pagesとして公開していました。Creating a GitHub Pages siteに従って、新しいレポジトリをつくり、このサイトを公開してみます。GitHub Pagesを公開するレポジトリ名は<user>.github.ioに限定されているようです

  1. 既存のレポジトリzunda/zunda.github.ioのSettings-PagesからGitHub PagesをUnpublish siteしビルド元のBranchをNoneにしSaveする
  2. レポジトリ名を変更する
  3. 新しいレポジトリzunda/zunda.github.ioを作る
  4. このサイトの内容をpushする
    $ git remote add origin git@github.com:zunda/zunda.github.io.git
    $ git push -u origin master
    
  5. 新しいレポジトリのSettingsからVisibilityをPublicにする
  6. 新しいレポジトリのSettings-PagesのBuild and deploymentから
    1. SourceをGitHub Actionsにして、
    2. JekyllをConfigureして、
    3. .github/workflows/jekyll.ymlの内容を確認して、Commit changes…する。右ペインのFestured Actionsのうち、CacheDownload a Build Artifactでインクリメンタルなビルドができるようになるかもしれない。

ここまでのメモを公開してみます。

$ git pull
$ git add _posts/2026-01-14-welcome-to-jekyll.md
$ git commit
$ git push

Rubyのバージョンを調整する

新しいレポジトリのActionsタブを確認すると、無事にworkflowが起動したようですが、エラー終了が記録されていました。ログを確認するには、失敗したrunのコミットメッセージをクリックし、赤いマークの付いているworkflowのステップをクリックし、エラーの表示されている行の上の行をクリックするようです。

Installing Bundler
  Using Bundler 4.0.3 from Gemfile.lock BUNDLED WITH 4.0.3
  /opt/hostedtoolcache/Ruby/3.1.6/x64/bin/gem install bundler -v 4.0.3
  ERROR:  Error installing bundler:
  	bundler-4.0.3 requires Ruby version >= 3.2.0. The current ruby version is 3.1.6.
  Took   0.36 seconds

.github/workflows/jekyll.ymlを眺めると、下記のようにruby/setup-rubyのタグが指定されているようです。このレポジトリのリリースは執筆時点でv1.283.0まで進んでいるようなので、これを使ってみます。

jobs:
  # Build job
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Setup Ruby
        # https://github.com/ruby/setup-ruby/releases/tag/v1.207.0
        uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4
        with:
          ruby-version: '3.1' # Not needed with a .ruby-version file
          bundler-cache: true # runs 'bundle install' and caches installed gems automatically
          cache-version: 0 # Increment this number if you need to re-download cached gems
diff --git a/.github/workflows/jekyll.yml b/.github/workflows/jekyll.yml
index 501686b..615d29b 100644
--- a/.github/workflows/jekyll.yml
+++ b/.github/workflows/jekyll.yml
@@ -34,10 +34,9 @@ jobs:
       - name: Checkout
         uses: actions/checkout@v4
       - name: Setup Ruby
-        # https://github.com/ruby/setup-ruby/releases/tag/v1.207.0
-        uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4
+        # https://github.com/ruby/setup-ruby/releases/tag/v1.283.0
+        uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e
         with:
-          ruby-version: '3.1' # Not needed with a .ruby-version file
           bundler-cache: true # runs 'bundle install' and caches installed gems automatically
           cache-version: 0 # Increment this number if you need to re-download cached gems
       - name: Setup Pages