1
0
mirror of https://github.com/TryGhost/Ghost.git synced 2024-12-30 14:22:07 +03:00
Ghost/core/server/data/meta/published_date.js
Hannah Wolfe dcc8bcc4f1 Strutured data: Slack Unfurls & published_at fix
refs 

- fixes a bug where published_at was incorrectly falling back to the created_at date
- updated meta index to get author name
- add written by & filed under labels + data if the values are present (only on posts/pages)
- updated tests
2016-02-22 01:45:00 +01:00

10 lines
274 B
JavaScript

function getPublishedDate(data) {
var context = data.context ? data.context[0] : null;
if (data[context] && data[context].published_at) {
return new Date(data[context].published_at).toISOString();
}
return null;
}
module.exports = getPublishedDate;