Wivern Blog

Personal-Tech memorandum

Octopress-Rakefileカスタマイズ

新規作成時bundle exec rake new_post[title]に前回書いたpublished<--more-->タグが初期値として 入ってくれたらよいと思うのでRakefileを修正する。 115行目あたりにかいてある。

Rakefile
1
2
3
4
5
6
7
8
9
10
11
post.puts "---"
post.puts "layout: post"
post.puts "title: \"#{title.gsub(/&/,'&amp;')}\""
post.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M:%S %z')}"
+ post.puts "author: [author]"
post.puts "comments: true"
+ post.puts "published: true
post.puts "categories: "
post.puts "---"
+ post.puts ""
+ post.puts "!--more--"

publishedの他に、authorの項目があるのでそれも設定。 これでbunde exec rake new_post[title]を実行するとテンプレートとしてデフォルト published: trueauthor: [author]と記事に頭で<!—more—>が初期値として入るようになるので 必要に併せて下書き中でdeployしたくなかったらpublished: falseに変更し、<!--more-->タグの 位置も変更すればよい。