Ghost/core/frontend/helpers/facebook_url.js
Hannah Wolfe 35e3e0708c Moved helper proxy into a service
- 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
2020-04-08 17:22:44 +01:00

20 lines
585 B
JavaScript

// # Facebook URL Helper
// Usage: `{{facebook_url}}` or `{{facebook_url author.facebook}}`
//
// Output a url for a facebook username
const {socialUrls, localUtils} = require('../services/proxy');
// We use the name facebook_url to match the helper for consistency:
module.exports = function facebook_url(username, options) { // eslint-disable-line camelcase
if (!options) {
options = username;
username = localUtils.findKey('facebook', this, options.data.site);
}
if (username) {
return socialUrls.facebook(username);
}
return null;
};