Created
July 2, 2013 20:24
-
-
Save steverydz/5912778 to your computer and use it in GitHub Desktop.
This is a plugin for Jekyll that adds ordinals to dates.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
require 'facets/integer/ordinal' | |
module Jekyll | |
module DateFilter | |
def prettydate(date) | |
"#{date.strftime('%e').to_i.ordinalize} #{date.strftime('%B')} #{date.strftime('%Y')}" | |
end | |
end | |
end | |
Liquid::Template.register_filter(Jekyll::DateFilter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use this the facets gem needs to be installed
gem install facets
. This file must be saved in the_plugins
directory. Then used like so:{{ post.date | prettydate }}
Note: This does not work for sites hosted on Github pages as plugins aren't supported.