Skip to content

Commit

Permalink
Support for Commento (Issue #2773) (#2978)
Browse files Browse the repository at this point in the history
* Initial untested commento support

* Fix so it works with latest docker image
  • Loading branch information
ralsina committed Mar 15, 2018
1 parent 59845c7 commit 2b4a8d5
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -4,6 +4,7 @@ New in master
Features
--------

* Support for Commento comment system (Issue #2773)
* New PRESERVE_ICC_PROFILES option to control whether ICC profiles are
preserved when copying images.
* Use baguetteJS in bootstrap theme (part of Issue #2777)
Expand Down
9 changes: 6 additions & 3 deletions docs/manual.txt
Expand Up @@ -1748,12 +1748,13 @@ Nikola supports several third party comment systems:
* `DISQUS <http://disqus.com>`_
* `IntenseDebate <http://www.intensedebate.com/>`_
* `LiveFyre <http://www.livefyre.com/>`_
* `Moot <http://moot.it>`_
* `Muut (Formerly moot) <http://muut.com>`_
* `Facebook <http://facebook.com/>`_
* `isso <http://posativ.org/isso/>`_
* `Commento <https://github.com/adtac/commento>`_

By default it will use DISQUS, but you can change by setting ``COMMENT_SYSTEM``
to one of "disqus", "intensedebate", "livefyre", "moot", "facebook" or "isso"
to one of "disqus", "intensedebate", "livefyre", "moot", "facebook", "isso" or "commento"

.. sidebar:: ``COMMENT_SYSTEM_ID``

Expand All @@ -1763,13 +1764,15 @@ to one of "disqus", "intensedebate", "livefyre", "moot", "facebook" or "isso"
* For DISQUS it's called the **shortname**
* In IntenseDebate it's the **IntenseDebate site acct**
* In LiveFyre it's the **siteId**
* In Moot it's your **username**
* In Muut it's your **username**
* For Facebook, you need to `create an app
<https://developers.facebook.com/apps>`_ (turn off sandbox mode!)
and get an **App ID**
* For isso, it is the URL of isso (must be world-accessible, encoded with
Punycode (if using Internationalized Domain Names) and **have a trailing slash**,
default ``http://localhost:8080/``)
* For commento it's the URL of the commento instance as required by the ``serverUrl``
parameter in commento's documentation.

To use comments in a visible site, you should register with the service and
then set the ``COMMENT_SYSTEM_ID`` option.
Expand Down
7 changes: 7 additions & 0 deletions nikola/data/themes/base/templates/comments_helper.tmpl
Expand Up @@ -6,6 +6,7 @@
<%namespace name="muut" file="comments_helper_muut.tmpl"/>
<%namespace name="facebook" file="comments_helper_facebook.tmpl"/>
<%namespace name="isso" file="comments_helper_isso.tmpl"/>
<%namespace name="commento" file="comments_helper_commento.tmpl"/>

<%def name="comment_form(url, title, identifier)">
%if comment_system == 'disqus':
Expand All @@ -20,6 +21,8 @@
${facebook.comment_form(url, title, identifier)}
% elif comment_system == 'isso':
${isso.comment_form(url, title, identifier)}
% elif comment_system == 'commento':
${commento.comment_form(url, title, identifier)}
%endif
</%def>

Expand All @@ -36,6 +39,8 @@
${facebook.comment_link(link, identifier)}
% elif comment_system == 'isso':
${isso.comment_link(link, identifier)}
% elif comment_system == 'commento':
${commento.comment_link(link, identifier)}
%endif
</%def>

Expand All @@ -52,5 +57,7 @@
${facebook.comment_link_script()}
% elif comment_system == 'isso':
${isso.comment_link_script()}
% elif comment_system == 'commento':
${commento.comment_link_script()}
%endif
</%def>
19 changes: 19 additions & 0 deletions nikola/data/themes/base/templates/comments_helper_commento.tmpl
@@ -0,0 +1,19 @@
## -*- coding: utf-8 -*-
<%def name="comment_form(url, title, identifier)">
<div id="commento"></div>
</%def>

<%def name="comment_link(link, identifier)">
</%def>


<%def name="comment_link_script()">
<script src="${comment_system_id}/assets/js/commento.min.js"></script>
<script>
window.onload = function() {
Commento.init({
serverUrl: "${comment_system_id}",
});
}
</script>
</%def>

0 comments on commit 2b4a8d5

Please sign in to comment.