2.6 KiB
layout | title | permalink |
---|---|---|
docs | Quick-start guide | /docs/quickstart/ |
If you already have Ruby and RubyGems installed (see Jekyll's requirements), you can create a new Jekyll site by doing the following:
# Install Jekyll and Bundler gems through RubyGems
~ $ gem install jekyll bundler
# Create a new Jekyll site at ./myblog
~ $ jekyll new myblog
# Change into your new directory
~ $ cd myblog
# Build the site on the preview server
~/myblog $ bundle exec jekyll serve
# Now browse to http://localhost:4000
gem install jekyll bundler
installs the jekyll and bundler gems through RubyGems. You need only to install the gems one time — not every time you create a new Jekyll project. Here are some additional details:
-
bundler
is a gem that manages other Ruby gems. It makes sure your gems and gem versions are compatible, and that you have all necessary dependencies each gem requires. -
The
Gemfile
andGemfile.lock
files inform Bundler about the gem requirements in your theme. If your theme doesn't have these Gemfiles, you can omitbundle exec
and just runjekyll serve
. -
When you run
bundle exec jekyll serve
, Bundler uses the gems and versions as specified inGemfile.lock
to ensure your Jekyll site builds with no compatibility or dependency conflicts.
jekyll new <PATH>
installs a new Jekyll site at the path specified (relative to current directory). In this case, Jekyll will be installed in a directory called myblog
. Here are some additional details:
- To install the Jekyll site into the directory you're currently in, run
jekyll new .
If the existing directory isn't empty, you can pass the--force
option withjekyll new . --force
. jekyll new
automatically initiatesbundle install
to install the dependencies required. (If you don't want Bundler to install the gems, usejekyll new myblog --skip-bundle
.)- By default, Jekyll installs a gem-based theme called Minima. With gem-based themes, some of the theme directories and files are stored in the gem, hidden from view in your Jekyll project. To better understand themes, see Themes.
Next steps
Building the default theme is just the first step. The real magic happens when you start creating blog posts, using the front matter to control templates and layouts, and taking advantage of all the awesome configuration options Jekyll makes available.