← back to the blog


Adding Dates to Blog Posts

Posted in KeystoneJS

I wanted to add dates to the blog post entries. I figure others might want to do to same, so here's how I did it:

 

In templates/views/blog.hbs, change the line that says:

{{#if author.name.first}}by {{author.name.first}}{{/if}}

so that is says this:

{{#if author.name.first}}by {{author.name.first}} on {{date publishedDate format='MMMM DD, YYYY'}}{{/if}

This uses the built in Handlebars date helper for format the existing date.