Jekyll 教程四:配置文件

HomeJekyllJekyll 教程四:配置文件

Jekyll 允许你以自己的任何方式来打造自己的网站,因为它有一个强大的配置选项。这些都可以在 _config.yml 文件中指定。

全局的配置项

设置 选项或者参数
Site Source
网站源文件的根目录
source: DIR
Site Destination
生成网站的目录地址
destination: DIR
Safe
是否使用自定义插件
safe: BOOL
Exclude
排除目录或者文件
exclude: [DIR, FILE, ...]
Include
包含的目录或者文件
include: [DIR, FILE, ...]
Time Zone
设置时区
timezone: TIMEZONE

编译的命令选项

设置 选项或者参数
Regeneration
文件被修改时,启动自动生成
-w, --watch
Configuration
指定一个配置文件,可以覆盖 _config.yml
--config FILE
Drafts
处理和渲染草稿文章
--drafts
Future
发布未来的文章
future: BOOL
--future
LSI
发布相关的文章
lsi: BOOL
--lsi
Limit Posts
限制文章发布的数量
limit_posts: NUM
--limit_posts NUM

服务器的命令选项

设置 选项或者参数
Local Server Port
本地服务器启动的端口号
port: PORT
--port PORT
Local Server Hostname
服务器名称
host: HOSTNAME
--host HOSTNAME
Base URL
基础链接
baseurl: URL
--baseurl URL

配置文件中,不允许有Tab,否则配置文件不能生效。默认的配置文件如下:

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
  • 作者「」于 更新本文
  • 文章声明:自由转载-非商用-非衍生-保持署名 | BY-NC-SA
← Jekyll 教程三:目录结构 Jekyll 教程五:常用变量→
  • 获取每日の能量源
  • ATP