Jekyll + Github Pages usage
How to use Jekyll for github-pages? Well, here is a summary.
Understanding project structure
Posts
Posts goes into the _posts
directory.
Jekyll requires blog post files to be named according to the following format: YEAR-MONTH-DAY-title.MARKUP
Where YEAR
is a four-digit number, MONTH
and DAY
are both two-digit numbers, and MARKUP
is the file extension representing the format used in the file. After that, include the necessary front matter.
Build, run and debug
You can rebuild the site in many different ways, but the most common way is to run bundle exec jekyll serve --drafts
, which launches a web server and auto-regenerates your site when a file is updated.
Run the server
bundle exec jekyll serve --drafts
Issues on Windows
For Windows, do this if the server does not works
gem uninstall eventmachine
# (uninstall all versions)
gem install eventmachine --platform ruby
code C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/eventmachine.rb
# add this line `require 'em/pure_ruby'` at the beggining
Project management
To update to the latest github dependencies
bundle update
Get location of gem files
bundle info --path <gem>
# e.g. bundle info --path minima
# e.g. bundle info --path jekyll-theme-midnight
To list current versions of github-pages
bundle exec github-pages versions
# online list here: https://pages.github.com/versions/