Ghost/core/frontend/meta/modified_date.js
Roshan Dash c81d11b910
🐛 Fixed published time and modified time for structured data (#12085)
closes #12059

- Published Time and Modified Time were not populating for 'page' context because it is an extension of 'post' and hence there was no context 'page'. 
- Fixed it by using the common contextObject & `getContextObject` utility. 
- Should also fix some other missing parameters.
2020-08-17 15:52:31 +01:00

19 lines
445 B
JavaScript

const getContextObject = require('./context_object.js');
function getModifiedDate(data) {
let context = data.context ? data.context : null;
let modDate;
const contextObject = getContextObject(data, context);
if (contextObject) {
modDate = contextObject.updated_at || null;
if (modDate) {
return new Date(modDate).toISOString();
}
}
return null;
}
module.exports = getModifiedDate;