Created
February 16, 2014 03:06
-
-
Save jeremywrowe/9028674 to your computer and use it in GitHub Desktop.
Jekyll Rake task for making a new post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc 'creates a new post prefixed with the current date' | |
task :post, :name, :title, :categories do |task, args| | |
File.open(File.join('_posts', Time.now.strftime("%Y-%m-%d-#{args[:name].split(' ').join('-')}.markdown")), 'w') do |file| | |
file << <<-DOC | |
--- | |
layout: post | |
title: "#{args[:title].downcase}" | |
date: #{Time.now.strftime("%Y-%m-%d-%H:%M:%S")} | |
categories: #{args[:categories].downcase} | |
--- | |
DOC | |
end | |
end |
rake -T #=> rake post[name,title,categories] # creates a new post prefixed with the current date
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage: rake 'post[the learning tree, the learning tree, learning development]'