diff options
-rw-r--r-- | _includes/ordinal.html | 4 | ||||
-rw-r--r-- | _includes/postmeta.html | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/_includes/ordinal.html b/_includes/ordinal.html new file mode 100644 index 0000000..690ef57 --- /dev/null +++ b/_includes/ordinal.html @@ -0,0 +1,4 @@ +{% if ordinalize == "1" or ordinalize == "21" or ordinalize == "31" %}st +{% elsif ordinalize == "2" or ordinalize == "22" %}nd +{% elsif ordinalize == "3" or ordinalize == "23" %}rd +{% else %}th{% endif %} diff --git a/_includes/postmeta.html b/_includes/postmeta.html index a44f36d..544ed34 100644 --- a/_includes/postmeta.html +++ b/_includes/postmeta.html @@ -10,10 +10,9 @@ possible on github pages (unless built locally and pushed there). {% else %} {{ node.author }} {% endif %} - {% if node.date %} - {% assign ordinal=node.date | ordinal %} - on {{ node.date | date: "%B %-d" }}{% if ordinal != node.date %}<sup>{{ ordinal }}</sup>{% endif %} - {{ node.date | date: "%Y" }} - {% endif %} + + {% assign ordinalize=node.date | date: "%-d" %} + on {{ node.date | date: "%B %-d" }}<sup>{% include ordinal.html %}</sup> + {{ node.date | date: "%Y" }} </small> </p> |