The Jekyll Ruby Gem provides an executable named jekyll
to be used at the command line. Jekyll is a robot, an engine to generate a site from a scaffold. Using the commands and options of Jekyll, a site could be created (command build
) or displayed in a web browser (command serve
).
Synopsis
Several commands and related options are available to control how the engine jekyll
generates a site.
jekyll <command> [options]
Find all commands available for the executable jekyll
with the following sections below.
Commands
To change Jekyll’s default behavior generating sites, have a look at the configuration options. All general options can be found with the section General commands. All specific commands and options to control build and serve processes for a site, see the sections for the Build command and the Serve command.
General commands
The executable jekyll
provides some general commands to create a new site scaffold from the scratch for example (based on the default theme Minima) or some support commands like doctor
to check the configuration of a site or clean
to reset an existing, already generated site.
Have a look through the commands and options available this section.
Command | Options | Description |
---|---|---|
|
| Creates a new Jekyll site with default gem-based theme. Using option |
|
| Outputs any deprecation or configuration issues. |
|
| Creates a new Jekyll theme scaffold. |
|
| Removes the generated site (folder |
|
| Shows help, optionally for a given subcommand like build. Example: |
Build command
Performs a one off build your site. For default, site pages gets written to the folder _site
.
jekyll build|b [options]
Typically you’ll use jekyll serve while developing and jekyll build if you need to generate the site for production. |
Option | Description |
---|---|
| Use custom configuration file. |
| The current folder will be generated into DESTINATION. |
| Custom source directory. |
| Publishes posts with a future date. |
| Limits the number of posts to parse and publish. |
| Watch for changes and rebuild |
| Serve the website from the given base URL. |
| Force watch to use polling. |
| Use LSI for improved related posts. |
| Render posts in the _drafts folder. |
| Render posts that were marked as unpublished. |
| Silence output. |
| Print verbose output |
| Enable incremental rebuild. |
| Fail if errors are present in front matter. |
| Show detailed options an flags. |
| Source directory. Defaults to current directory |
| Destination directory. Defaults to |
| Safe mode. Defaults to |
| Plugins directory. Defaults to |
| Layouts directory. Defaults to |
| Generate a Liquid rendering profile. |
| Show the full backtrace when an error occurs. |
| Print the name and version. |
Serve command
Create your site any time a source file changes and serves it locally using builtin web server WEBRick. For default, site pages gets written to the folder _site
in your project root.
jekyll serve|s [options]
Typically you’ll use jekyll serve while developing locally and jekyll build when you need to generate the site for production. |
Options | Description |
---|---|
| Use custom configuration file. |
| The current folder will be generated into DESTINATION |
| Custom source directory. |
| Publishes posts with a future date |
| Limits the number of posts to parse and publish. |
| Watch for changes and rebuild. |
| Serve the website from the given base URL. |
| Force watch to use polling. |
| Use |
| Render posts in the _drafts folder |
| Render posts that were marked as unpublished. |
| Silence the output. |
| Print verbose output |
| Enable incremental rebuild. |
| Fail if errors are present in front matter. |
| X.509 (SSL) certificate neede for HTTPS connections. |
| X.509 (SSL) Private Key needed for HTTPS connections. |
| Host to bind to. |
| Launch your site in a browser. |
| Run the server in the background. Not available for the Windows operating system. |
| Port to listen on. |
| Show a directory listing instead of loading your index file. |
| Skips the initial site build which occurs before the server is started |
| Use LiveReload to automatically refresh browsers. |
| Files for LiveReload to ignore. Remember to quote the values so your shell won’t expand them. |
| Minimum reload delay. |
| Maximum reload delay. |
| Port for LiveReload to listen on. |
| Show detailed options an flags. |
| Source directory. Defaults to current directory |
| Destination directory. Defaults to |
| Safe mode. Defaults to |
| Plugins directory. Defaults to |
| Layouts directory. Defaults to |
| Generate a Liquid rendering profile. |
| Show the full backtrace when an error occurs. |
| Print the name and version. |
Examples
Find some common jekyll
CLI commands for build
and serve
.
Build a site from custom configuration
Typically you’ll use jekyll serve
while developing locally and jekyll build
when you need to generate the site for production.
jekyll b -c ./site_configs/_config.yml
Build a site in mode incremental
Typically you’ll use jekyll serve
while developing locally and jekyll build
when you need to generate the site for production.
jekyll b --incremental
Run a site in mode incremental
Typically you’ll use jekyll serve
while developing locally and jekyll build
when you need to generate the site for production.
jekyll s --incremental