mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
35e3e0708c
- The proxy is not a helper, we want the helpers folder to only include helpers - The proxy is also meant to be the interface to Ghost for the helpers, and we want to enforce that - This is a small step on the way
17 lines
604 B
JavaScript
17 lines
604 B
JavaScript
// # URL helper
|
|
// Usage: `{{url}}`, `{{url absolute="true"}}`
|
|
//
|
|
// Returns the URL for the current object scope i.e. If inside a post scope will return post permalink
|
|
// `absolute` flag outputs absolute URL, else URL is relative
|
|
|
|
const {SafeString, metaData} = require('../services/proxy');
|
|
const {getMetaDataUrl} = metaData;
|
|
|
|
module.exports = function url(options) {
|
|
var absolute = options && options.hash.absolute && options.hash.absolute !== 'false',
|
|
outputUrl = getMetaDataUrl(this, absolute);
|
|
|
|
outputUrl = encodeURI(decodeURI(outputUrl));
|
|
|
|
return new SafeString(outputUrl);
|
|
};
|