:memo: 使用这些命令在 Jekyll 中简化您的写作。
使用一些命令来简化 Jekyll 中的编写工作。
将以下行添加到您应用程序的 Gemfile 中: gem 'jekyll-compose', 组: [:jekyll_plugins] 然后执行: $ bundle
安装完毕后(见上文),运行 bundle exec jekyll help 即可看到:
在帮助中,您将看到可供您使用的新命令:
draft # Creates a new draft post with the given NAME
post # Creates a new post with the given NAME
publish # Moves a draft into the _posts directory and sets the date
unpublish # Moves a post back into the _drafts directory
page # Creates a new page with the given NAME
rename # Moves a draft to a given NAME and sets the title
compose # Creates a new file with the given NAME使用以下内容创建新页面:
$ bundle exec jekyll page "My New Page"使用以下内容创建新帖子:
$ bundle exec jekyll post "My New Post"
# or specify a custom format for the date attribute in the yaml front matter
$ bundle exec jekyll post "My New Post" --timestamp-format "%Y-%m-%d %H:%M:%S %z" # or by using the compose command
$ bundle exec jekyll compose "My New Post" # or by using the compose command with post specified
$ bundle exec jekyll compose "My New Post" --post # or by using the compose command with the posts collection specified
$ bundle exec jekyll compose "My New Post" --collection "posts"使用以下内容创建新的草稿:
$ bundle exec jekyll draft "My new draft" # or by using the compose command with draft specified
$ bundle exec jekyll compose "My new draft" --draft # or by using the compose command with the drafts collection specified
$ bundle exec jekyll compose "My new draft" --collection "drafts"使用以下方法重命名您的草稿:
$ bundle exec jekyll rename _drafts/my-new-draft.md "My Renamed Draft"# 或者将其重新命名
$ bundle exec jekyll rename _draf
[][travis]
[][appveyor]
[travis]: https://travis-ci.org/jekyll/jekyll-compose
[appveyor]: https://ci.appveyor.com/project/jekyll/jekyll-compose暂无开放 Issues,或尚未同步最近议题。