2016-05-17 16:06:12 +03:00
|
|
|
// # Facebook URL Helper
|
|
|
|
// Usage: `{{facebook_url}}` or `{{facebook_url author.facebook}}`
|
|
|
|
//
|
2018-01-28 20:25:06 +03:00
|
|
|
// Output a url for a facebook username
|
2017-04-04 19:07:35 +03:00
|
|
|
var proxy = require('./proxy'),
|
|
|
|
socialUrls = proxy.socialUrls,
|
2017-12-13 16:05:53 +03:00
|
|
|
localUtils = proxy.localUtils;
|
2016-05-17 16:06:12 +03:00
|
|
|
|
2017-11-01 16:44:54 +03:00
|
|
|
// We use the name facebook_url to match the helper for consistency:
|
|
|
|
module.exports = function facebook_url(username, options) { // eslint-disable-line camelcase
|
2016-05-17 16:06:12 +03:00
|
|
|
if (!options) {
|
|
|
|
options = username;
|
2017-12-13 16:05:53 +03:00
|
|
|
username = localUtils.findKey('facebook', this, options.data.blog);
|
2016-05-17 16:06:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (username) {
|
2017-12-15 00:22:37 +03:00
|
|
|
return socialUrls.facebook(username);
|
2016-05-17 16:06:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
};
|