Created
July 21, 2017 18:52
-
-
Save blairanderson/8015fc9901bd443f973edc7e656dc1de to your computer and use it in GitHub Desktop.
[Ruby][files,writing,frontmatter] How to create a frontmatter file for each week
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
start_date = Date.today + 1.month | |
end_date = start_date + 2.years | |
(start_date..end_date).group_by(&:wday)[1].each do |day| | |
pathname = "_drafts/weekly/#{day.year}/#{day.strftime("%m-%d")}.md" | |
open(pathname, 'w+') do |post| | |
post.puts "---" | |
post.puts "layout: weekly" | |
post.puts "title: Black River Weekly - #{day.strftime('%B %d %Y')}" | |
post.puts "category: weekly" | |
post.puts "---" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment