2016-05-17 14:06:12 +01:00
|
|
|
// # Facebook URL Helper
|
|
|
|
// Usage: `{{facebook_url}}` or `{{facebook_url author.facebook}}`
|
|
|
|
//
|
2018-01-28 09:25:06 -08:00
|
|
|
// Output a url for a facebook username
|
2021-09-28 15:06:33 +01:00
|
|
|
const {socialUrls} = require('../services/proxy');
|
|
|
|
const {localUtils} = require('../services/rendering');
|
2016-05-17 14:06:12 +01:00
|
|
|
|
2017-11-01 13:44:54 +00: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 14:06:12 +01:00
|
|
|
if (!options) {
|
|
|
|
options = username;
|
2019-09-10 11:37:04 +02:00
|
|
|
username = localUtils.findKey('facebook', this, options.data.site);
|
2016-05-17 14:06:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (username) {
|
2017-12-14 22:22:37 +01:00
|
|
|
return socialUrls.facebook(username);
|
2016-05-17 14:06:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
};
|