Fixing permalink support
This commit is contained in:
parent
94c06d0100
commit
15c5a78a47
|
@ -66,7 +66,7 @@ module Jekyll
|
|||
# Returns <String>
|
||||
def dir
|
||||
if permalink
|
||||
permalink.to_s.split("/")[0..-2].join("/")
|
||||
permalink.to_s.split("/")[0..-2].join("/") + '/'
|
||||
else
|
||||
prefix = self.categories.empty? ? '' : '/' + self.categories.join('/')
|
||||
prefix + date.strftime("/%Y/%m/%d/")
|
||||
|
@ -87,7 +87,7 @@ module Jekyll
|
|||
#
|
||||
# Returns <String>
|
||||
def url
|
||||
self.dir + self.slug + ".html"
|
||||
permalink || self.dir + self.slug + ".html"
|
||||
end
|
||||
|
||||
# The UID for this post (useful in feeds)
|
||||
|
|
|
@ -43,7 +43,15 @@ class TestPost < Test::Unit::TestCase
|
|||
p.process("2008-12-03-permalinked-post.textile")
|
||||
p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-12-03-permalinked-post.textile")
|
||||
|
||||
assert_equal "my_category", p.dir
|
||||
assert_equal "my_category/", p.dir
|
||||
end
|
||||
|
||||
def test_url_respects_permalink
|
||||
p = Post.allocate
|
||||
p.process("2008-12-03-permalinked-post.textile")
|
||||
p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-12-03-permalinked-post.textile")
|
||||
|
||||
assert_equal "my_category/permalinked-post", p.url
|
||||
end
|
||||
|
||||
def test_read_yaml
|
||||
|
|
Loading…
Reference in New Issue