Jekyll is a static site generator with blogging capabilities. For blogging it looks for files starting with a datestamp. In its original form, Jekyll only supports hyphen separated calendar dates (YEAR-MONTH-DAY
).
This plugin file tries to implement ISO 8601 datestamps and give you a little more freedom when stamping your posts and building your permalinks with dates.
Drop the postdates.rb file in your _plugins directory. If you do not have one already you can create it in the site source directory. For more information, check out the plugins page on the Jekyll wiki.
This plugin works by rewriting the post processing and url generation of Jekyll completely. (Also called monkey patching.) This means the plugin is neither forward nor backward compatible. It might be, but it is better to have no illusions about it.
Please only use this with Jekyll 0.11.0. You can run jekyll --version
if you want to find out what version of Jekyll you have installed.
- Calendar dates:
YEAR-MONTH-DAY
,YEARMONTHDAY
YEAR
: 4 or more digits, ± allowed but ignoredMONTH
: 2 digits,DAY
: 2 digits
- Ordinal dates:
YEAR-DAY
,YEARDAY
YEAR
: 4 or more digits, ± allowed but ignoredDAY
: 3 digits
-
ISO 8601 allows for negative years to be used, to assign dates to events that happened BCE. This plugin does parse datestamps beginning with
-
but ignores it’s meaning. This means blog posts dated-2011-01-01
will equal blog posts from2011-01-01
. Just don’t blog into the past.Note that the less often used but valid
+
is also accepted and ignored. -
ISO 8601 requires either a
+
or-
in front of expanded year notations (ie.02011
should be+02011
). In actual use however, mostly promoted by the Long Now Foundation (more here), the+
is almost always left out. It is therefore not required by this plugin. -
ISO 8601 allows both ordinal and calendar dates to be written without separators. It also allows for years of over 4 digits on both. This means there are many possible conflicts.
20110101
could be2011-01-01
or20110-101
. This plugin does not try to fix this.
longnow
: same asyear
but padded up to a length of 5 digits. Example:02011
.yday
: the ordinal date. Example:012
.i_yday
: the ordinal date without leading zeroes. Example:12
.
- Week dates
- Try to move permalink additions out of the
url
method, a little less monkey patching. - Liquid tags for ordinal date and padded years.