Skip to content

Commit

Permalink
Merge 460e377 into 5343fc3
Browse files Browse the repository at this point in the history
  • Loading branch information
parkr committed Dec 11, 2014
2 parents 5343fc3 + 460e377 commit c8a31cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/jekyll/site.rb
Expand Up @@ -183,6 +183,7 @@ def read_directories(dir = '')
end

pages.sort_by!(&:name)
static_files.sort_by!(&:relative_path)
end

# Read all the files in <source>/<dir>/_posts and create a new Post
Expand Down Expand Up @@ -377,7 +378,7 @@ def site_payload
"time" => time,
"posts" => posts.sort { |a, b| b <=> a },
"pages" => pages,
"static_files" => static_files.sort { |a, b| a.relative_path <=> b.relative_path },
"static_files" => static_files,
"html_pages" => pages.select { |page| page.html? || page.url.end_with?("/") },
"categories" => post_attr_hash('categories'),
"tags" => post_attr_hash('tags'),
Expand Down
8 changes: 3 additions & 5 deletions lib/jekyll/static_file.rb
Expand Up @@ -3,6 +3,8 @@ class StaticFile
# The cache of last modification times [path] -> mtime.
@@mtimes = Hash.new

attr_reader :relative_path

# Initialize a new StaticFile.
#
# site - The Site.
Expand All @@ -15,18 +17,14 @@ def initialize(site, base, dir, name, collection = nil)
@dir = dir
@name = name
@collection = collection
@relative_path = File.join(*[@dir, @name].compact)
end

# Returns source file path.
def path
File.join(*[@base, @dir, @name].compact)
end

# Returns the source file path relative to the site source
def relative_path
@relative_path ||= File.join(*[@dir, @name].compact)
end

def extname
File.extname(path)
end
Expand Down

0 comments on commit c8a31cc

Please sign in to comment.