2016-12-25 00:01:43 +00:00
|
|
|
# Adds metadata to the post object for linking to the source page.
|
|
|
|
Jekyll::Hooks.register :posts, :pre_render do |post, payload|
|
|
|
|
if post.path =~ /\.md$/
|
|
|
|
post.data['md_file'] = "/#{post.data['category']}/#{post.basename}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-12-24 22:26:51 +00:00
|
|
|
# Copy all of the source markdown files directly into the destination.
|
|
|
|
Jekyll::Hooks.register :site, :post_write do |site|
|
|
|
|
dest = site.dest
|
2016-12-25 00:01:43 +00:00
|
|
|
site.posts.docs.select{|p| p.path =~ /\.md$/}.each do |post|
|
|
|
|
FileUtils.cp(post.path, "#{dest}/#{post.data['category']}/#{post.basename}")
|
2016-12-24 22:26:51 +00:00
|
|
|
end
|
|
|
|
end
|