This short guides shows you how to setup a new skeleton Jekyll project, using the Jekyll CLI to generate the files for you.
This guide does not require Jekyll to be installed globally. Rather, it takes you through installing Jekyll in a new project that only has one file in it, then uses that project Jekyll to create all the Jekyll base files in the same directory.
Under Jekyll docs, you can see the Installation page. That provides links to install for each OS. These are covered in some detail here.
See also New under my Jekyll recipes for a few ways to set up a new Jekyll site.
Install Ruby 2.7 and then Bundler as a global gem. Follow instructions in gist.
Don't install Jekyll globally with gem
or bundler
unless you really have a usecase for that. Your projects will be more robust and easier to run on different machines (including those of other developers) if you ensure Jekyll gets installed at the project gems level, not the global level.
If you like, you can see a template repo at MichaelCurrin/jekyll-blog-demo. You can pick that or add it to your own repos, then clone it and install.
Or, continue below for a flow where you use the Jekyll new
command rather to bootstrap a project.
I cover here how to initialize project with Jekyll and no content first. Then I cover I how to use the jekyll new
to create a new template Jekyll project.
Create a new project and add Jekyll to it.
$ mkdir my-project
$ cd my-project
$ bundle config set --local path vendor/bundle
$ echo 'source "https://rubygems.org"
gem "jekyll", "~> 3.9"
' > Gemfile
$ bundle install
Side note - you could use bundle init
to generate a new Gemfile
, but it adds things you don't need.
Now you can add your content.
If you want to initialize your project with Jekyll's base project, use this. It will use the currently installed Jekyll to create a new Jekyll project in the current directory. Overwriting your existing Gemfile.
$ bundle exec jekyll new . --force
$ ls
404.html Gemfile Gemfile.lock _config.yml _posts about.md index.md vendor
Make sure you have Kramdown GH Parser listed as a gem in Gemfile
, otherwise Jekyll won't serve.
gem "jekyll", "~> 3.9"
gem "kramdown-parser-gfm", "~> 1.1"
Configure Bundler again and install Gems.
$ bundle config set --local path vendor/bundle
$ bundle install
Now you're ready to serve.
$ bundle exec jekyll serve --trace --livereload