Introduction

To run Jekyll on a site, we’ll navigate to the site’s directory in the command line, then run one of these commands.

Serve

jekyll serve

Does a build of the site to _site and runs a local development server at http://localhost:4000 by default. Any changes we make to a site (except edits to _config.yml) trigger the site to rebuild and the development server to refresh. This command is typically used while you’re developing a site as it automatically builds and serves your site locally after a change.

Build

jekyll build

This builds the site to _site. From here we would typically copy the contents of _site to a hosting provider.

Runtime flags

There’s a number of runtime flags we can pass these commands to adjust how the site is built. For example if we wanted the build to include all of our draft blog posts we could run jekyll like this:

jekyll build --drafts

Below is a full list of the run time parameters available. Many of these can be added to your _config.yml if you want them to run every time, check the configuration documentation for more information.

Setting Flags

Site Source

Change the directory where Jekyll reads files.

-s, --source DIR

Site Destination

Change the directory where Jekyll writes files.

-d, --destination DIR

Safe

Disable custom plugins and ignore symbolic links.

--safe

Regeneration

Automatically regenerate the site when files are modified.

-w, --[no-]watch

Configuration

Specify config files instead of using _config.yml automatically. Settings in later files override settings in earlier files.

--config FILE1[,FILE2,...]

Drafts

Process and render draft posts.

--drafts

Environment

Use a specific environment value in the build.

JEKYLL_ENV=production

Future

Publish posts or collection documents with a future date.

--future

LSI

Produce an index for related posts.

--lsi

Limit Posts

Limit the number of posts to parse and publish.

--limit_posts NUM

Force polling

Force watch to use polling.

--force_polling

Verbose output

Print verbose output.

-V, --verbose

Silence Output

Silence the normal output from Jekyll during a build.

-q, --quiet

Incremental build

Enable the experimental incremental build feature. Incremental build only re-builds posts and pages that have changed, resulting in significant performance improvements for large sites, but may also break site generation in certain cases.

-I, --incremental