Jekyll from scratch
Build a Github-page hosted Jekyll static website from scratch.
Installation
Ruby
sudo apt-get install ruby-full build-essential zlib1g-dev
- Avoid installing Ruby Gems as the root user. Therefore, we need to set up a gem installation directory for your user account.
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Jekyll
gem install jekyll bundler
Basic website
Create a new folder
mkdir my_website && cd $_
Create a new
Gemfile
bundle init
Edit the Gemfile and add
jekyll
as a dependencyecho gem \"jekyll\" >> Gemfile
Install jekyll for your project
bundle
Add a home page
<!doctype html><html><head><meta charset="utf-8"><title>Home</title></head><body><h1>Hello World!</h1></body></html>Serve the website
jekyll serve
Test
- Go to
http://localhost:4000
in your browser. You should see “Hello World!”.
- Go to
Use minima
minima
is the defaut template to build a new website.
Use as a remote theme
jekyll new my_website
cd my_website
bundle exec jekyll serve
Local customization
- Style
- Templates
GitHub Pages host
- Update
Gemfile
- Remove the
gem "jekyll"
- Uncomment
gem "github-pages", group: :jekyll_plugins
- Remove the version information of
jekyll-feed
- Remove the
- Update bundle