Skip to content

Instantly share code, notes, and snippets.

@trobrock
Created November 8, 2012 19:27
Show Gist options
  • Save trobrock/4040968 to your computer and use it in GitHub Desktop.
Save trobrock/4040968 to your computer and use it in GitHub Desktop.
Helper for creating posts with jekyll `./create_post.rb "some title"`
#!/usr/bin/env ruby
require 'stringex'
title = ARGV.first
date = "#{Time.now.year}-#{Time.now.month}-#{Time.now.day}"
file_name = "#{date}-#{title.to_url}.md"
File.open(File.join("_posts", file_name), 'w') do |f|
f.puts "---"
f.puts "layout: post"
f.puts "title: #{title}"
f.puts "date: #{date}"
f.puts "---"
end
puts "Created #{file_name}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment