Skip to content

Commit

Permalink
feat: add injector "to" config
Browse files Browse the repository at this point in the history
  • Loading branch information
hms5232 committed Jan 20, 2022
1 parent d412554 commit f609549
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ fb_comments:
```yml
fb_comments:
enabled: true # 是否開啟 FB 留言外掛
to: post # 有 post、page 或 default(全選)等,詳細選項請參考 hexo injector
app_id: # FB 應用程式編號
lang: zh_TW # 語言
num_posts: 5 # 顯示幾則留言
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function initConfig() {
if (!_config.enabled)
return false;

_config.to = _config.to || 'post';
_config.lang = _config.lang || 'zh_TW';
_config.numPosts = _config.num_posts || 5;
_config.orderBy = _config.order_by || 'reverse-time';
Expand Down Expand Up @@ -49,5 +50,5 @@ function fbComments(args, content) {
return html;
}

hexo.extend.injector.register('head_end', fbCommentsHead(), 'post');
hexo.extend.injector.register('head_end', fbCommentsHead(), _config.to);
hexo.extend.tag.register('fb_comments', fbComments, {async: true});

0 comments on commit f609549

Please sign in to comment.