mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03: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
20 lines
576 B
JavaScript
20 lines
576 B
JavaScript
// # Twitter URL Helper
|
|
// Usage: `{{twitter_url}}` or `{{twitter_url author.twitter}}`
|
|
//
|
|
// Output a url for a twitter username
|
|
const {socialUrls, localUtils} = require('../services/proxy');
|
|
|
|
// We use the name twitter_url to match the helper for consistency:
|
|
module.exports = function twitter_url(username, options) { // eslint-disable-line camelcase
|
|
if (!options) {
|
|
options = username;
|
|
username = localUtils.findKey('twitter', this, options.data.site);
|
|
}
|
|
|
|
if (username) {
|
|
return socialUrls.twitter(username);
|
|
}
|
|
|
|
return null;
|
|
};
|