From 0e8f2040113fd4ca49ca138925f6c01f9e7197b0 Mon Sep 17 00:00:00 2001 From: Marko Locher Date: Sat, 7 May 2016 16:58:44 +0200 Subject: [PATCH] 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 --- lib/jekyll/tags/post_url.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/tags/post_url.rb b/lib/jekyll/tags/post_url.rb index 04c1ef29..c8b820b8 100644 --- a/lib/jekyll/tags/post_url.rb +++ b/lib/jekyll/tags/post_url.rb @@ -14,7 +14,7 @@ module Jekyll "'#{name}' does not contain valid date and/or title." end - @name_regex = %r!^#{path}#{date}-#{slug}\.[^.]+! + @name_regex = %r!^_posts/#{path}#{date}-#{slug}\.[^.]+|^#{path}_posts/?#{date}-#{slug}\.[^.]+! end def post_date @@ -23,7 +23,7 @@ module Jekyll end def ==(other) - other.basename.match(@name_regex) + other.relative_path.match(@name_regex) end def deprecated_equality(other)