diff --git a/documentation/content/Connecting With Your Readers/commentbox-comments.md b/documentation/content/Connecting With Your Readers/commentbox-comments.md new file mode 100644 index 00000000..aaf7d03d --- /dev/null +++ b/documentation/content/Connecting With Your Readers/commentbox-comments.md @@ -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 +``` diff --git a/documentation/pelicanconf.py b/documentation/pelicanconf.py index b2696c24..9ac31b1a 100755 --- a/documentation/pelicanconf.py +++ b/documentation/pelicanconf.py @@ -190,3 +190,4 @@ } DISQUS_FILTER = True UTTERANCES_FILTER = True +COMMENTBOX_FILTER = True diff --git a/documentation/publishconf.py b/documentation/publishconf.py index 26803b52..4918a0f9 100644 --- a/documentation/publishconf.py +++ b/documentation/publishconf.py @@ -22,6 +22,7 @@ STAT_COUNTER_SECURITY = os.environ.get("STAT_COUNTER_SECURITY_PROD") GOOGLE_ANALYTICS = os.environ.get("GOOGLE_ANALYTICS_PROD") DISQUS_SITENAME = os.environ.get("DISQUS_SITENAME") + COMMENTBOX_PROJECT = os.environ.get("COMMENTBOX_PROJECT") elif os.environ.get("CONTEXT") == "branch-deploy" and os.environ.get("HEAD") == "next": SITENAME = "Elegant (Next)" diff --git a/templates/_includes/_defaults.html b/templates/_includes/_defaults.html index 4615aeb0..95a2bf82 100644 --- a/templates/_includes/_defaults.html +++ b/templates/_includes/_defaults.html @@ -85,6 +85,12 @@ {% set UTTERANCES_LABEL = UTTERANCES_LABEL %} {% endif %} +{% if not COMMENTBOX_FILTER %} +{% set COMMENTBOX_FILTER = False %} +{% else %} +{% set COMMENTBOX_FILTER = COMMENTBOX_FILTER %} +{% endif %} + {# Author's twitter handle. Used in Twitter card meta data #} {% if not TWITTER_USERNAME %} {% set TWITTER_USERNAME = '' %} diff --git a/templates/_includes/commentbox_scripts.html b/templates/_includes/commentbox_scripts.html new file mode 100644 index 00000000..888b5508 --- /dev/null +++ b/templates/_includes/commentbox_scripts.html @@ -0,0 +1,14 @@ +{% macro comments_script_commentbox(project, identifier) %} +
+ + +{% endmacro %} diff --git a/templates/_includes/comments.html b/templates/_includes/comments.html index 86d8c799..2b38cceb 100644 --- a/templates/_includes/comments.html +++ b/templates/_includes/comments.html @@ -1,11 +1,13 @@ {% macro comments_section(article) %} -{% from '_includes/_defaults.html' import DISQUS_FILTER, UTTERANCES_FILTER with context %} +{% from '_includes/_defaults.html' import DISQUS_FILTER, UTTERANCES_FILTER, COMMENTBOX_FILTER with context %} {% set use_disqus = (not DISQUS_FILTER or article.disqus_filter == "off") and DISQUS_SITENAME and article.disqus_filter != "on" %} {% set use_utterances = (not UTTERANCES_FILTER or article.utterances_filter == "off") and UTTERANCES_REPO and article.utterances_filter != "on" %} +{% set use_commentbox = (not COMMENTBOX_FILTER or article.commentbox_filter == "off") and COMMENTBOX_PROJECT and article.commentbox_filter != "on" %} + {% set url = SITEURL+ '/' + article.url %} {% set identifier = SITEURL+ '/' + article.url %} {% if article.comment_id %} @@ -20,7 +22,7 @@ {% set intro = article.comments_intro %} {% endif %} -{% if article.status != 'draft' and article.comments != 'False' and (use_disqus or use_utterances) %} +{% if article.status != 'draft' and article.comments != 'False' and (use_disqus or use_utterances or use_commentbox) %}
Comments
@@ -29,7 +31,7 @@
Comments