hexo-social9-socialshare
Version:
Social9 social sharing plugin provides you beautiful buttons, sharing capabilities, and analytics. (20+ buttons- Whatsapp, Facebook, Twitter, LinkedIn, Reddit, and many more...)
21 lines (18 loc) • 842 B
JavaScript
hexo.extend.helper.register('social9Script', function (options) {
const { id, content, async, defer } = Object.assign({ id: 's9-sdk', content: '', async: true, defer: true}, options)
if(content == ""){
log.info('content field is required');
return '';
}
return `<script id="${id}" ${async} ${defer} content="${content}" src="//cdn.social9.com/js/socialshare.min.js"></script>`;
})
hexo.extend.tag.register('social9Inline', function (args, content) {
return social9Inline(content)
}, { ends: true })
hexo.extend.helper.register('social9Inline', function (content) {
return social9Inline(content)
}, { ends: true })
function social9Inline (options) {
const { id, classes } = Object.assign({ id: '', classes: 's9-widget-wrapper'}, options)
return `<div${id?" id=\""+id:''}${classes?" class=\""+classes:''}"></div>`;
}