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. |
|
Site Destination Change the directory where Jekyll writes files. |
|
Safe Disable custom plugins and ignore symbolic links. |
|
Regeneration Automatically regenerate the site when files are modified. |
|
Configuration Specify config files instead of using |
|
Drafts Process and render draft posts. |
|
Environment Use a specific environment value in the build. |
|
Future Publish posts or collection documents with a future date. |
|
LSI Produce an index for related posts. |
|
Limit Posts Limit the number of posts to parse and publish. |
|
Force polling Force watch to use polling. |
|
Verbose output Print verbose output. |
|
Silence Output Silence the normal output from Jekyll during a build. |
|
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. |
|