Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

add "updated" property and month name template for naming posts #508

Closed
wants to merge 2 commits into from

2 participants

@wez

The "updated" yaml property allows you to track a separate updated date/time for posts.

The "mname" template allows use of the lowercased three-letter month name (e.g.: "dec") for the generated posts URLs.

@parkr
Owner

What is the benefit of this? I'm not sure what practical use this has.

@parkr parkr closed this
@parkr
Owner

Closing due to lack of response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 19, 2011
  1. @wez
Commits on Feb 12, 2012
  1. @wez

    Merge remote-tracking branch 'mojombo/master'

    wez authored
    Conflicts:
    	lib/jekyll/post.rb
This page is out of date. Refresh to see the latest.
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
attr_reader :name
@@ -46,6 +46,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
@@ -64,7 +67,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
@@ -129,6 +134,7 @@ def 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,
Something went wrong with that request. Please try again.