diff --git a/lib/jekyll/static_file.rb b/lib/jekyll/static_file.rb index e11d6689..927a9b47 100644 --- a/lib/jekyll/static_file.rb +++ b/lib/jekyll/static_file.rb @@ -1,6 +1,6 @@ module Jekyll class StaticFile - attr_reader :relative_path, :extname + attr_reader :relative_path, :extname, :name class << self # The cache of last modification times [path] -> mtime. @@ -97,6 +97,8 @@ module Jekyll def to_liquid { + "basename" => File.basename(name, extname), + "name" => name, "extname" => extname, "modified_time" => modified_time, "path" => File.join("", relative_path) diff --git a/site/_docs/static_files.md b/site/_docs/static_files.md index 00afbaec..19d45089 100644 --- a/site/_docs/static_files.md +++ b/site/_docs/static_files.md @@ -26,7 +26,7 @@ following metadata:
file.path
- The relative path to the file.
+ The relative path to the file, e.g /assets/img/image.jpg
file.modified_time
- The `Time` the file was last modified.
+ The `Time` the file was last modified, e.g 2016-04-01 16:35:26 +0200
+
+
file.name
+
+ The string name of the file e.g. image.jpg
for image.jpg
+
+
file.basename
+
+ The string basename of the file e.g. image
for image.jpg