From b5a398bdffb56c117046110df52db7c30b24955c Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 19 Feb 2014 13:35:13 -0500 Subject: [PATCH] Add StaticFile#to_liquid and StaticFile#relative_path --- lib/jekyll/static_file.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/jekyll/static_file.rb b/lib/jekyll/static_file.rb index 3d863ca7..bc39b178 100644 --- a/lib/jekyll/static_file.rb +++ b/lib/jekyll/static_file.rb @@ -21,6 +21,11 @@ module Jekyll File.join(@base, @dir, @name) end + # Returns the source file path relative to the site source + def relative_path + path.sub(/\A#{@site.source}/, '') + end + # Obtain destination path. # # dest - The String path to the destination dir. @@ -66,5 +71,12 @@ module Jekyll @@mtimes = Hash.new nil end + + def to_liquid + { + "path" => relative_path, + "modified_time" => mtime.to_s + } + end end end