Jekyll liquid filter to output a date ordinal such as "st", "nd", "rd", or "th".
To use this with your Jekyll site, copy ordinal.rb
to your _plugins
folder.
NOTE: Because GitHub Pages disables the use of any Jekyll plugins with the --safe
option if you want to deploy your Jekyll site to GitHub you’ll need to convert the site locally and push the generated static files to your GitHub repository instead of the Jekyll source files.
To use the filter, simply pass a date string such as page.date
or post.date
and the filter will return the ordinal for that day.
{{ page.date | ordinal }}
Note that only the ordinal will be returned. This is by design to make the formatting of the ordinal easier such as wrapping it in <sup>
html tags.
<sup>{{ page.date | ordinal }}</sup>
humanize
which adds a several liquid filters, including one for date ordinals.This plugin is hereby released into the public domain. To the extent possible, the author places no restrictions upon its use, modification, or redistribution.