Rework plugin to work a bit more cleanly. Add metadata and print blurb at bottom of posts.
This commit is contained in:
parent
e50152d3d1
commit
9cf8456d7c
|
@ -12,4 +12,9 @@ layout: default
|
|||
{{ content }}
|
||||
</div>
|
||||
|
||||
<div class="post-verify">
|
||||
{% if page.md_file %}
|
||||
The markdown source for this post is available here: <a href="{{page.md_file}}">{{page.md_file}}</a> <br/>
|
||||
{% endif %}
|
||||
</div>
|
||||
</article>
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
# 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
|
||||
categories = site.config['category_metadata'].each_key do |category|
|
||||
dir = Dir.new("#{site.source}/_posts/#{category}")
|
||||
dir.each do |filename|
|
||||
next unless filename =~ /\.md$/
|
||||
FileUtils.cp("#{dir.path}/#{filename}", "#{dest}/#{category}/")
|
||||
end
|
||||
site.posts.docs.select{|p| p.path =~ /\.md$/}.each do |post|
|
||||
FileUtils.cp(post.path, "#{dest}/#{post.data['category']}/#{post.basename}")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,3 +36,7 @@
|
|||
font-size: $large-font-size;
|
||||
padding: 0px 10px;
|
||||
}
|
||||
|
||||
.post-verify {
|
||||
font-size: $small-font-size;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user