Ghost/core/frontend/meta/author_url.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

21 lines
699 B
JavaScript

const urlService = require('../services/url');
const getContextObject = require('./context_object.js');
function getAuthorUrl(data, absolute) {
let context = data.context ? data.context[0] : null;
const contextObject = getContextObject(data, context);
if (data.author) {
return urlService.getUrlByResourceId(data.author.id, {absolute: absolute, secure: data.author.secure, withSubdirectory: true});
}
if (contextObject && contextObject.primary_author) {
return urlService.getUrlByResourceId(contextObject.primary_author.id, {absolute: absolute, secure: contextObject.secure, withSubdirectory: true});
}
return null;
}
module.exports = getAuthorUrl;