TheByteDungeon

TheByteDungeon is a personal tech blog where I document my thoughts, explore technical challenges, and reinforce my knowledge.

Home Posts Projects View on GitHub
24 August 2024

Understanding GitHub Pages and Jekyll

GitHub Pages allows you to host websites directly from your GitHub repository. Simple as pie? :heart: :computer:

Jekyll themes?

Let’s explore the supported themes.

Some favorites:

Configuration

We just update the theme in the _config.yml file.
theme: jekyll-theme-chirpy

plugins

We can update the _config.yml to include new features using plugins. We can then support GitHub emojis with jemoji. :metal:

Layouts

Default layout (ex. layout: post) can be found here. You can create your own like this.

File structure (added 1/9)

Reading the docs, I apparently need to change the file structure of my posts:

├── _posts
│   ├── 2007-10-29-why-every-programmer-should-play-nethack.md
│   └── 2009-04-26-barcamp-boston-4-roundup.md

Running Jekyll locally

Then we use the GitHub pages guide to get Jekyll up and running:

  1. Ruby is already installed in my WSL setup.
    • I had an old version of ruby so used ruby-install to install a newer version.
    • Ruby path /home/vthoren_u/.rubies/ruby-3.3.4/bin/ruby
       echo '# Install Ruby Gems to ~/gems' >> ~/.zshrc
       echo 'export GEM_HOME="$HOME/gems"' >> ~/.zshrc
       echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.zshrc
       alias gem="/home/vthoren_u/.rubies/ruby-3.3.4/bin/gem"
       source ~/.zshrc
      
  2. Installing bundle and jekyll gem install jekyll bundler
  3. Fixing the Gemfile with the version of github-pages
  4. Install dependencies bundle install
  5. Start jekyll bundle exec jekyll serve
  6. Test! http://127.0.0.1:4000/

Continue to develop the site

The post from aleksandrhovhannisyan.com is really good at getting started!

tags: jekyll - github pages