简体   繁体   中英

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM