Fix #3926 post_url helper with sub-directories

Instead of matching the the value provided to `post_url` against
the basename, test against the relative path.

Updated the regexp to match both
  * _posts/category
  * category/_posts
This commit is contained in:
Marko Locher 2016-05-07 16:58:44 +02:00
parent 8a3ea59141
commit 0e8f204011
1 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ module Jekyll
"'#{name}' does not contain valid date and/or title." "'#{name}' does not contain valid date and/or title."
end end
@name_regex = %r!^#{path}#{date}-#{slug}\.[^.]+! @name_regex = %r!^_posts/#{path}#{date}-#{slug}\.[^.]+|^#{path}_posts/?#{date}-#{slug}\.[^.]+!
end end
def post_date def post_date
@ -23,7 +23,7 @@ module Jekyll
end end
def ==(other) def ==(other)
other.basename.match(@name_regex) other.relative_path.match(@name_regex)
end end
def deprecated_equality(other) def deprecated_equality(other)