New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ordinal date permalink style (/YYYY/DDD/slug.html) #928

Merged
merged 1 commit into from Apr 7, 2013

Conversation

Projects
None yet
5 participants
@danieldriver
Contributor

danieldriver commented Apr 6, 2013

Following up on issue #926 I propose to add an ordinal date option for permalink styles. In addition to date and pretty it provides the style ordinal, as well as the template variable y_day.

Thus, in the config file, permalink: ordinal => /:categories/:year/:y_day/:title.html.

This is a standard way of counting time in astronomy, so it would be ideal for star gazers. (Witness the ordinal/Julian date converter at NASA.) Some public transit systems also issue tickets stamped with the three digit day stamp, so it might appeal to a blog about commuting.

My own use case is for an academic journal that uses the ordinal date with article DOIs (digital object identifiers). We would like to map our URL structure to the DOI stamps on articles.

Thanks to @parkr and @zachgersh for help moving this forward. As with #890 it would be wonderful to see included in the 1.0 milestone!

@@ -170,6 +172,7 @@ def url
"i_month" => date.strftime("%m").to_i.to_s,
"categories" => categories.map { |c| URI.escape(c.to_s) }.join('/'),
"short_month" => date.strftime("%b"),
"y_day" => date.strftime("%j"),

This comment has been minimized.

@zachgersh

zachgersh Apr 6, 2013

Contributor

I thought this was going to be year_day? I would go with your original name and switch this (it is much more clear).

This comment has been minimized.

@danieldriver

danieldriver Apr 6, 2013

Contributor

Unfortunately, year_day didn't pass the rake test (it parsed the year and returned 2008_day. I went with y_day on analogy with @mojombo's original i_day and i_month. I suppose j_day is also possible, but I'm not sure that most people are familiar with Julian dates.

@@ -146,6 +146,8 @@ def template
"/:categories/:title.html"
when :date
"/:categories/:year/:month/:day/:title.html"
when :ordinal
"/:categories/:year/:y_day/:title.html"

This comment has been minimized.

@zachgersh

zachgersh Apr 6, 2013

Contributor

Do you really need an ordinal case? Seems like it would be handled fine by just having the variable available.

This comment has been minimized.

@danieldriver

danieldriver Apr 6, 2013

Contributor

It's not strictly necessary, but it is the most obvious way to use y_day in a permalink. It adds clarity, since this kind of date is called an ordinal date, and it also follows the ISO 8601 ordinal date format.

@mojombo

This comment has been minimized.

Contributor

mojombo commented Apr 7, 2013

This seems like a fine addition, and I'm ok with adding the ordinal permalink type.

@parkr

This comment has been minimized.

Member

parkr commented Apr 7, 2013

@mojombo How do you feel about y_day?

parkr added a commit that referenced this pull request Apr 7, 2013

Merge pull request #928 from danieldriver/ordinal_date
add ordinal date permalink style (/YYYY/DDD/slug.html)

@parkr parkr merged commit 8bf55ef into jekyll:master Apr 7, 2013

1 check passed

default The Travis build passed
Details
@mojombo

This comment has been minimized.

Contributor

mojombo commented Apr 7, 2013

@parkr I'm fine with y_day.

parkr added a commit that referenced this pull request Apr 7, 2013

@danieldriver danieldriver deleted the danieldriver:ordinal_date branch Oct 15, 2013

@danieldriver danieldriver restored the danieldriver:ordinal_date branch Oct 15, 2013

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.