mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-07 11:30:55 +03:00
4a56d10c86
closes #4231 - Adds {{image}} helper - Adds image_spec test unit - Updated {{ghost_head}} to use image helper
21 lines
594 B
JavaScript
21 lines
594 B
JavaScript
|
|
// Usage: `{{image}}`, `{{image absolute="true"}}`
|
|
//
|
|
// Returns the URL for the current object scope i.e. If inside a post scope will return image permalink
|
|
// `absolute` flag outputs absolute URL, else URL is relative.
|
|
|
|
var Promise = require('bluebird'),
|
|
config = require('../config'),
|
|
image;
|
|
|
|
image = function (options) {
|
|
var absolute = options && options.hash.absolute;
|
|
if (this.image) {
|
|
return Promise.resolve(config.urlFor('image', {image: this.image}, absolute));
|
|
} else {
|
|
return Promise.resolve();
|
|
}
|
|
};
|
|
|
|
module.exports = image;
|