How can I modify my Ghost.org blog's date format
Asked Answered
E

1

6

My Ghost.org blog displays dates as:

04 Nov 2013

This is controlled in content\themes\{theme-name}\post.hbs via:

<time datetime="{{date format="YYYY-MM-DD"}}">
    {{date format='DD MMM YYYY'}}
</time> 

I want this changed to a different format, like Wednesday, 4th November 2013, how can I do this?

Erelia answered 6/11, 2013 at 14:5 Comment(0)
E
11

Ghost uses Moment.js to output dates.

From their display format documentation we can determine that:

  • dddd can be used to output the full day name;
  • MMMM can be used to output the full month name;
  • Do can be used to output the date in 1st 2nd 3rd 4th... format;
  • YYYY can be used to output the full year number.

From this we can craft our desired date format in content\themes\{theme-name}\post.hbs using:

<time datetime="{{date format="YYYY-MM-DD"}}">
    {{date format='dddd, MMMM Do YYYY'}}
</time>

Wednesday, 4th November 2013

Erelia answered 6/11, 2013 at 14:5 Comment(1)
@starfry indeed I do, not sure how I managed that - I'm already linking to their documentation on the line below!Erelia

© 2022 - 2024 — McMap. All rights reserved.