lib/jekyll/post.rb in jekyll-0.3.0 vs lib/jekyll/post.rb in jekyll-0.4.1

- old
+ new

@@ -59,19 +59,23 @@ end # The generated directory into which the post will be placed # upon generation. This is derived from the permalink or, if # permalink is absent, set to the default date - # e.g. "/2008/11/05/" + # e.g. "/2008/11/05/" if the permalink style is :date, otherwise nothing # # 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/") + if Jekyll.permalink_style == :date + prefix + date.strftime("/%Y/%m/%d/") + else + prefix + '/' + end end end # The full path and filename of the post. # Defined in the YAML of the post body @@ -85,11 +89,11 @@ # The generated relative url of this post # e.g. /2008/11/05/my-awesome-post.html # # Returns <String> def url - self.dir + self.slug + ".html" + permalink || self.dir + self.slug + ".html" end # The UID for this post (useful in feeds) # e.g. /2008/11/05/my-awesome-post # @@ -152,10 +156,10 @@ # Convert this post into a Hash for use in Liquid templates. # # Returns <Hash> def to_liquid - { "title" => self.data["title"] || "", + { "title" => self.data["title"] || self.slug.split('-').select {|w| w.capitalize! || w }.join(' '), "url" => self.url, "date" => self.date, "id" => self.id, "topics" => self.topics, "content" => self.content }.deep_merge(self.data)