Use post's directory path when matching for the post_url tag

This commit is contained in:
Dave Cole 2013-04-25 13:58:05 -04:00
parent 61c24c601a
commit fc09ac4862
1 changed files with 5 additions and 3 deletions

View File

@ -6,13 +6,15 @@ module Jekyll
attr_accessor :date, :slug attr_accessor :date, :slug
def initialize(name) def initialize(name)
who, cares, date, slug = *name.match(MATCHER) all, path, date, slug = *name.sub(/^\//, "").match(MATCHER)
@slug = slug @slug = path ? path + slug : slug
@date = Time.parse(date) @date = Time.parse(date)
end end
def ==(other) def ==(other)
slug == other.slug && path = other.name.split("/")[0...-1].join("/")
otherslug = path != "" ? path + '/' + other.slug : other.slug
slug == otherslug &&
date.year == other.date.year && date.year == other.date.year &&
date.month == other.date.month && date.month == other.date.month &&
date.day == other.date.day date.day == other.date.day