Creating a Website/Portfolio with Jekyll
Introduction
Whether for an online portfolio or a website, I've noticed that more and more developers have started using website building frameworks as an alternative to the low-code/codeless website builders, which often require payments for additional customization.
Quite a popular service among these is Jekyll, which seems to be a popular choice due to its integration with GitHub Pages, which enables direct hosting from your GitHub repository.
Of course, there are other services such as Gatsby (now integrated with Netlify), Hugo, MkDocs, and Pelican. However, choosing the best service for your use would largely depend on a number of considerations:
Ease of setup. Is setting up the environment and installing dependencies easy?
Available Integrations. Is it able to integrate with the technology stack you are using or are familiar with?
Learning Curve. How easy is it to learn how to deploy your portfolio or website with the service?
Programming Language. If you plan on customizing your website a bit more than others do (e.g. without using templates/by creating your own templates), it's also important to consider the programming language/s in which the service is written.
Availability of Templates. If you plan on using templates that are readily available online, how easy is it to access these templates and integrate them into your portfolio?
Speed. How easy is it to load the contents of the website/portfolio using the service?
In this post, we'll be focusing more on Jekyll as I provide a step-by-step guide on how to build your own portfolio with Jekyll.
Dependencies
Note: As I am using a MacOS system, the instructions I will be providing are based on the MacOS syntax.
Install HomeBrew in your system.
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
If you have already installed it, then update it to the latest version available.
$ brew update $ brew upgrade $ brew cleanup
Install the LTS version of Node.js
Install Ruby
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew install chruby ruby-install xz ruby-install ruby 3.1.3 echo "source $(brew --prefix)/opt/chruby/share/chruby/chruby.sh" >> ~/.zshrc echo "source $(brew --prefix)/opt/chruby/share/chruby/auto.sh" >> ~/.zshrc echo "chruby ruby-3.1.3" >> ~/.zshrc # run 'chruby' to see actual version
Installation
In the folder where the website/portfolio is being built, install Jekyll and generate a new site.
$ gem install jekyll $ jekyll new <my-site>
This will generate the default theme called "minima".
Update the gem file to include Jekyll and Github Pages
source "https://rubygems.org" gem "jekyll" gem "github-pages"
Bundle and install the dependencies
$ bundle install
- Edit the
_config.yaml
file
baseurl: /
url: https://<siteurl>
- Edit the index file. This will be the main page of your website/portfolio.
---
layout: default
title: My GitHub Pages Site
---
<h1> Lorem Ipsum </h1>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
- Run the build and preview the file
$ bundle exec jekyll build
$ bundle exec jekyll serve
This will show a live preview of your website/portfolio at http://localhost:4000
Note: You might encounter an issue with the webrick dependency which might cause the build to fail. If that happens, install the webrick dependency.
$ bundle add webrick
If you're creating from a template, do not generate a new Jekyll template. Instead, run the following steps after installing the dependencies:
Fork the template into your repository
Clone the repository into your local environment
Install dependencies
$ npm install $ bundle install $ gem install jekyll
Edit the files to your liking.
Stage the changes to your GitHub repository
$ git add .
Commit the changes and provide a comprehensive commit message.
$ git -m "<comment>"
In some templates, Gulp needs to be installed. However, this is not the case for all of the templates. Be sure to check the
Readme
file of the template you'll be using.
$ npm install gulp-cli global
$ npm install --save-dev gulp-cli
- Run the build and preview the file.
$ bundle exec jekyll build
$ bundle exec jekyll serve
# or use gulp if it is available
$ gulp
If Gulp is used, then the preview is hosted at http://localhost:3000
References
Subscribe to my newsletter
Read articles from Grace Icay directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Grace Icay
Grace Icay
JLPT N3-certified QA Engineer working in Japan!