Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added abbreviated month + test. #890

Merged
merged 2 commits into from

3 participants

@zachgersh

This is my stab at #410. Hopefully this helps us get to the 1.0 milestone! Know the change is relatively simple but if you need anything drop me a comment.

@mattr-
Owner

:+1: from me. Would prefer to see my change to the key made before this is merged, but either way, I'm good with this.

@parkr
Owner

I'd prefer something like short_month. @mojombo will probably have thoughts on this as well.

@zachgersh

@parkr @mattr- figured the thing that would be most up for discussion was the naming convention :wink:

Thanks so much for the feedback! Let me know if this should be changed around again.

@zachgersh

Any word on a merge for this guys? Already working on a separate commit for another issue I'd like to tackle!

@parkr parkr commented on the diff
test/test_post.rb
@@ -225,6 +225,17 @@ def do_render(post)
end
end
+ context "with custom abbreviated month date permalink" do
+ setup do
+ @post.site.permalink_style = '/:categories/:year/:short_month/:day/:title/'
+ @post.process(@fake_file)
+ end
+
+ should "process the url correctly" do
+ assert_equal "/2008/Sep/09/foo-bar/", @post.url
@parkr Owner
parkr added a note

Any reason you would prefer capitalized over lowercase?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@zachgersh

I believe it's automatically returned capitalized. I have no preference either way and we could standardize on lowercase if that is the preferred way to go. Could set to lowercase and add another test to make sure the casing is always consistent?

@parkr
Owner

Right, that's what I was thinking. I'm just not sure I like the lowercase version... Hm.

Do you have a preference? As you write your blog, would you prefer one or the other?

@zachgersh

Personally, for me, I'd prefer the month's to stick to the capitalized abbreviation as that would be my expectation if I was going to abbreviate a month anywhere.

@parkr
Owner

Ok capital it is!

@parkr parkr merged commit 483a0b6 into jekyll:master

1 check passed

Details default The Travis build passed
@parkr parkr referenced this pull request from a commit
@parkr parkr Update history to reflect merge of #890 464ea6e
@parkr parkr referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 0 deletions.
  1. +1 −0  lib/jekyll/post.rb
  2. +11 −0 test/test_post.rb
View
1  lib/jekyll/post.rb
@@ -169,6 +169,7 @@ def url
"i_day" => date.strftime("%d").to_i.to_s,
"i_month" => date.strftime("%m").to_i.to_s,
"categories" => categories.map { |c| URI.escape(c.to_s) }.join('/'),
+ "short_month" => date.strftime("%b"),
"output_ext" => self.output_ext
}.inject(template) { |result, token|
result.gsub(/:#{Regexp.escape token.first}/, token.last)
View
11 test/test_post.rb
@@ -225,6 +225,17 @@ def do_render(post)
end
end
+ context "with custom abbreviated month date permalink" do
+ setup do
+ @post.site.permalink_style = '/:categories/:year/:short_month/:day/:title/'
+ @post.process(@fake_file)
+ end
+
+ should "process the url correctly" do
+ assert_equal "/2008/Sep/09/foo-bar/", @post.url
@parkr Owner
parkr added a note

Any reason you would prefer capitalized over lowercase?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ end
+ end
+
context "with prefix style and no extension" do
setup do
@post.site.permalink_style = "/prefix/:title"
Something went wrong with that request. Please try again.