-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(comments): add support for CommentBox
- Loading branch information
Showing
6 changed files
with
86 additions
and
3 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
documentation/content/Connecting With Your Readers/commentbox-comments.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
Title: Comments -- Enable CommentBox | ||
Tags: interaction | ||
Category: Connecting With Your Readers | ||
Date: 2020-02-05 22:35 | ||
Slug: enable-commentbox-comments | ||
Summary: Elegant offers CommentBox comments out of the box with few unique features | ||
authors: Talha Mansoor | ||
comment_id: 3a307b7d45 | ||
commentbox_filter: off | ||
--- | ||
|
||
You can use [CommentBox](https://commentbox.io/) for comments. You have to set `COMMENTBOX_PROJECT` to your CommentBox project ID. | ||
|
||
That's it. Elegant will take care of the rest. | ||
|
||
You can see a working example of CommentBox comments in this article. | ||
|
||
## Show CommentBox comments by default | ||
|
||
Just set `COMMENTBOX_PROJECT` variable. | ||
|
||
## Hide CommentBox comments by default | ||
|
||
Unset `COMMENTBOX_PROJECT` variable. | ||
|
||
This is the default setting. | ||
|
||
## Hide CommentBox comments by default. Show on Selected | ||
|
||
1. Set `COMMENTBOX_PROJECT` | ||
1. Set `COMMENTBOX_FILTER` to `True` | ||
|
||
This will hide CommentBox form on all pages. | ||
|
||
Now to show CommentBox form on selected posts, in article metadata set | ||
|
||
```yaml | ||
commentbox_filter: off | ||
``` | ||
## Show CommentBox comments by default. Hide on Selected | ||
1. Set `COMMENTBOX_PROJECT` | ||
1. Remove `COMMENTBOX_FILTER` or set it to `False` which is its default value | ||
|
||
This will hide CommentBox form on all pages. | ||
|
||
Now to hide CommentBox form on selected posts, in article metadata set | ||
|
||
```yaml | ||
commentbox_filter: on | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,3 +190,4 @@ | |
} | ||
DISQUS_FILTER = True | ||
UTTERANCES_FILTER = True | ||
COMMENTBOX_FILTER = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% macro comments_script_commentbox(project, identifier) %} | ||
<div class="commentbox" id="{{ identifier }}"></div> | ||
<script src="https://unpkg.com/commentbox.io/dist/commentBox.min.js"></script> | ||
<script> | ||
commentBox("{{ project }}", { | ||
onCommentCount(count) { | ||
const ele = document.querySelector("#comment-accordion-toggle") | ||
if (ele && count > 0) { | ||
ele.innerText = `${count} Comment${count > 1 ? 's' : ''}` | ||
} | ||
} | ||
}); | ||
</script> | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters