# 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 # Copy all of the source markdown files directly into the destination. Jekyll::Hooks.register :site, :post_write do |site| dest = site.dest site.posts.docs.select{|p| p.path =~ /\.md$/}.each do |post| FileUtils.cp(post.path, "#{dest}/#{post.data['category']}/#{post.basename}") end end