Skip to content
Browse files

add updated property for yaml frontmatter, add month name for permalink

  • Loading branch information...
1 parent b3634b5 commit edb51ce745c3ac63ca6c87e69a1ded726f3936b8 @wez committed Mar 19, 2011
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/jekyll/post.rb
View
10 lib/jekyll/post.rb
@@ -20,7 +20,7 @@ def self.valid?(name)
attr_accessor :site
attr_accessor :data, :content, :output, :ext
- attr_accessor :date, :slug, :published, :tags, :categories
+ attr_accessor :date, :updated, :slug, :published, :tags, :categories
# Initialize this Post instance.
# +site+ is the Site
@@ -44,6 +44,9 @@ def initialize(site, source, dir, name)
# ensure Time via to_s and reparse
self.date = Time.parse(self.data["date"].to_s)
end
+ if self.data.has_key?('updated')
+ self.updated = Time.parse(self.data["updated"].to_s)
+ end
if self.data.has_key?('published') && self.data['published'] == false
self.published = false
@@ -62,7 +65,9 @@ def initialize(site, source, dir, name)
#
# Returns -1, 0, 1
def <=>(other)
- cmp = self.date <=> other.date
+ d = self.updated || self.date
+ o = other.updated || other.date
+ cmp = d <=> o
if 0 == cmp
cmp = self.slug <=> other.slug
end
@@ -122,6 +127,7 @@ def url
@url ||= {
"year" => date.strftime("%Y"),
"month" => date.strftime("%m"),
+ "mname" => date.strftime("%b").downcase,
"day" => date.strftime("%d"),
"title" => CGI.escape(slug),
"i_day" => date.strftime("%d").to_i.to_s,

0 comments on commit edb51ce

Please sign in to comment.
Something went wrong with that request. Please try again.