Add category to rake new_post
This commit is contained in:
@@ -25,6 +25,7 @@ task :new_post, :title do |t, args|
|
||||
if File.exist?(filename)
|
||||
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
|
||||
end
|
||||
category = get_stdin("Enter category name to group your post in (leave blank for none): ")
|
||||
tags = get_stdin("Enter tags to classify your post (comma separated): ")
|
||||
puts "Creating new post: #{filename}"
|
||||
open(filename, 'w') do |post|
|
||||
@@ -32,6 +33,7 @@ task :new_post, :title do |t, args|
|
||||
post.puts "layout: post"
|
||||
post.puts "title: \"#{title.gsub(/&/,'&')}\""
|
||||
post.puts "modified: #{Time.now.strftime('%Y-%m-%d %H:%M:%S %z')}"
|
||||
post.puts "category: [#{category}]"
|
||||
post.puts "tags: [#{tags}]"
|
||||
post.puts "image:"
|
||||
post.puts " feature: "
|
||||
|
||||
Reference in New Issue
Block a user