ruby - Get Post Full Path in Jekyll/Octopress -
in octopress, i'm trying post's full file path (something ~/projects/site/source/_posts/2012-01-01-something.markdown
) extending jekyll:post
class.
module jekyll class post alias_method :original_to_liquid, :to_liquid def to_liquid # test if function called puts "hello" original_to_liquid.deep_merge({ 'full_path' => file.join(@base,@name) }) end end end
i name file full_path.rb
, put in plugins
folder. oddly, to_liquid
function never called, since hello
message didn't show up.
even more strange, find date.rb
shipped octopress defines to_liquid
method of class post
, add full_path => file.join(@base,@name)
line there , works! i'm soooo confused.
so question is, why to_liquid
method didn't called?
update
after upgrading jekyll 0.12.0 1.2.1, magically works......
you might take @ post#permalink
documentation. should want without having create new plugins.
(if misunderstood you, maybe containing_dir method you're looking for)
Comments
Post a Comment