mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 00:11:49 +03:00
76bd4fdef6
* 🙀 change database schema for images
- rename user/post/tag images
- contains all the required changes from the schema change
* Refactor helper/meta data
- rename cover to cover_image
- also rename default settings to match the pattern
- rename image to profile_image for user
- rename image to feature_image for tags/posts
* {{image}} >>> {{img_url}}
- rename
- change the functionality
- attr is required
- e.g. {{img_url feature_image}}
* gscan 1.0.0
- update yarn.lock
* Update casper reference: 1.0-changes
- see 5487b4da8d
22 lines
713 B
JavaScript
22 lines
713 B
JavaScript
var utils = require('../../utils'),
|
|
getContextObject = require('./context_object.js'),
|
|
_ = require('lodash');
|
|
|
|
function getCoverImage(data) {
|
|
var context = data.context ? data.context : null,
|
|
contextObject = getContextObject(data, context);
|
|
|
|
if (_.includes(context, 'home') || _.includes(context, 'author')) {
|
|
if (contextObject.cover_image) {
|
|
return utils.url.urlFor('image', {image: contextObject.cover_image}, true);
|
|
}
|
|
} else {
|
|
if (contextObject.feature_image) {
|
|
return utils.url.urlFor('image', {image: contextObject.feature_image}, true);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
module.exports = getCoverImage;
|