11 KiB
layout | title | prev_section | next_section | permalink |
---|---|---|---|---|
docs | Configuration | structure | frontmatter | /docs/configuration/ |
Jekyll allows you to concoct your sites in any way you can dream up, and it’s
thanks to the powerful and flexible configuration options that this is possible.
These options can either be specified in a _config.yml
file placed in your
site’s root directory, or can be specified as flags for the jekyll
executable
in the terminal.
Configuration Settings
Global Configuration
The table below lists the available settings for Jekyll, and the various options
(specified in the configuration file) and flags
(specified on the command-line) that control them.
Setting | Options and Flags |
---|---|
Site Source Change the directory where Jekyll will read files |
|
Site Destination Change the directory where Jekyll will write files |
|
Safe Disable custom plugins. |
|
Exclude Exclude directories and/or files from the conversion |
|
Include
Force inclusion of directories and/or files in the conversion.
|
|
Time Zone
Set the time zone for site generation. This sets the |
|
Build Command Options
Setting | Options and Flags |
---|---|
Regeneration Enable auto-regeneration of the site when files are modified. |
|
Configuration Specify a config file. Overrides settings in |
|
Drafts Process and render draft posts. |
|
Future Publish posts with a future date. |
|
LSI Produce an index for related posts. |
|
Limit Posts Limit the number of posts to parse and publish. |
|
Serve Command Options
In addition to the options below, the serve
sub-command can accept any of the options
for the build
sub-command, which are then applied to the site build which occurs right
before your site is served.
Setting | Options and Flags |
---|---|
Local Server Port Listen on the given port. |
|
Local Server Hostname Listen at the given hostname. |
|
Base URL Serve the website from the given base URL |
|
Do not use tabs in configuration files
This will either lead to parsing errors, or Jekyll will revert to the default settings. Use spaces instead.
Default Configuration
Jekyll runs with the following configuration options by default. Unless alternative settings for these options are explicitly specified in the configuration file or on the command-line, Jekyll will run using these options.
There are two unsupported kramdown options
Please note that both remove_block_html_tags and remove_span_html_tags are currently unsupported in jekyll due to the fact that they are not included within the kramdown HTML converter.
{% highlight yaml %} source: . destination: ./_site plugins: ./_plugins layouts: ./_layouts include: ['.htaccess'] exclude: [] keep_files: ['.git','.svn'] timezone: nil
future: true show_drafts: nil limit_posts: 0 pygments: true
relative_permalinks: true
permalink: date paginate_path: 'page:num'
markdown: maruku markdown_ext: markdown,mkd,mkdn,md textile_ext: textile
excerpt_separator: "\n\n"
safe: false watch: false # deprecated server: false # deprecated host: 0.0.0.0 port: 4000 baseurl: / url: http://localhost:4000 lsi: false
maruku: use_tex: false use_divs: false png_engine: blahtex png_dir: images/latex png_url: /images/latex
rdiscount: extensions: []
redcarpet: extensions: []
kramdown: auto_ids: true footnote_nr: 1 entity_output: as_char toc_levels: 1..6 smart_quotes: lsquo,rsquo,ldquo,rdquo use_coderay: false
coderay: coderay_wrap: div coderay_line_numbers: inline coderay_line_numbers_start: 1 coderay_tab_width: 4 coderay_bold_every: 10 coderay_css: style
redcloth: hard_breaks: true {% endhighlight %}
Markdown Options
The various Markdown renderers supported by Jekyll sometimes have extra options available.
Redcarpet
Redcarpet can be configured by providing an extensions
sub-setting, whose value should be an array of strings. Each string should be the name of one of the Redcarpet::Markdown
class's extensions; if present in the array, it will set the corresponding extension to true
.
Jekyll handles two special Redcarpet extensions:
-
no_fenced_code_blocks
--- By default, Jekyll sets thefenced_code_blocks
extension (for delimiting code blocks with triple tildes or triple backticks) totrue
, probably because GitHub's eager adoption of them is starting to make them inescapable. Redcarpet's normalfenced_code_blocks
extension is inert when used with Jekyll; instead, you can use this inverted version of the extension for disabling fenced code.Note that you can also specify a language for highlighting after the first delimiter:
```ruby # ...ruby code ```
With both fenced code blocks and pygments enabled, this will statically highlight the code; without pygments, it will add a
class="LANGUAGE"
attribute to the<code>
element, which can be used as a hint by various JavaScript code highlighting libraries. -
smart
--- This pseudo-extension turns on SmartyPants, which converts straight quotes to curly quotes and runs of hyphens to em (---
) and en (--
) dashes.
All other extensions retain their usual names from Redcarpet, and no renderer options aside from smart
can be specified in Jekyll. A list of available extensions can be found in the Redcarpet README file. Make sure you're looking at the README for the right version of Redcarpet: Jekyll currently uses v2.2.x, and extensions like footnotes
and highlight
weren't added until after version 3.0.0. The most commonly used extensions are:
tables
no_intra_emphasis
autolink