docs/_docs/upgrading/0-to-2.md
Upgrading from an older version of Jekyll? A few things have changed in 1.0 and 2.0 that you'll want to know about.
Before we dive in, go ahead and fetch the latest version of Jekyll:
gem update jekyll
For better clarity, Jekyll now accepts the commands build and serve.
Whereas before you might simply run the command jekyll to generate a site
and jekyll --server to view it locally, in v2.0 (and later) you should
use the subcommands jekyll build and jekyll serve to build and preview
your site.
In Jekyll v1.0, we introduced absolute permalinks for pages in subdirectories. Starting with v2.0, absolute permalinks are opt-out, meaning Jekyll will default to using absolute permalinks instead of relative permalinks. Relative permalink backwards-compatibility was removed in v3.0.
<div class="note warning" id="absolute-permalinks-warning"> <h5 markdown="1">Absolute permalinks will be required in v3.0 and on</h5> <p markdown="1"> Starting with Jekyll v3.0, relative permalinks functionality will be removed and thus unavailable for use. </p> </div>Jekyll now lets you write draft posts, and allows you to easily preview how
they will look prior to publishing. To start a draft, create a folder
called _drafts in your site's source directory (e.g., alongside _posts),
and add a new markdown file to it. To preview your new post, run the
jekyll serve command with the --drafts flag.
Rather than passing individual flags via the command line, you can now pass
an entire custom Jekyll config file. This helps to distinguish between
environments, or lets you programmatically override user-specified
defaults. Add the --config flag to the jekyll command, followed
by the path to one or more config files (comma-delimited, no spaces).
--no-server--no-auto (now --no-watch)--auto (now --watch)--server--url=--maruku, --rdiscount, and --redcarpet--pygments--permalink=--paginateJekyll 1.0 introduced several new config file options. Before you upgrade, you should check to see if any of these are present in your pre-1.0 config file, and if so, make sure that you're using them properly:
excerpt_separatorhostincludekeep_fileslayoutsshow_draftstimezoneurlOften, you'll want the ability to run a Jekyll site in multiple places,
such as previewing locally before pushing to GitHub Pages. Jekyll 1.0 makes
that easier with the new --baseurl flag. To take advantage of this
feature, first add the production baseurl to your site's _config.yml
file. Then, throughout the site, prefix relative URLs
with {% raw %}{{ site.baseurl }}{% endraw %}.
When you're ready to preview your site locally, pass along the --baseurl
flag with your local baseurl (most likely /) to jekyll serve and Jekyll
will swap in whatever you've passed along, ensuring all your links work as
you'd expect in both environments.