# Adds metadata to the post object for linking to the source page. # Also adds metadata linking to the gpg signature file, if it exists. Jekyll::Hooks.register :posts, :pre_render do |post, payload| if post.path =~ /\.md$/ post.data['md_file'] = "/#{post.data['category']}/#{post.basename}" sig_filename = "#{post.path}.asc" if File.exist?(sig_filename) post.data['sig_file'] = post.data['md_file'] + '.asc' end end end # Copy all of the source markdown files and signature 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['md_file']}") sig_filename = "#{post.path}.asc" if File.exist?(sig_filename) FileUtils.cp(sig_filename, "#{dest}/#{post.data['sig_file']}") end end end