diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2015-01-03 19:08:30 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2015-01-03 19:10:29 +0100 |
commit | adefa3853855aac303ff6cab5b8a43564b584890 (patch) | |
tree | a4ca0173e365b8b70d8b267ff76caaf7716f7c4e /plugins/disqus_static/README.rst | |
parent | 237ae081dbade817f4a2033b6aa2d3cdeb15b8b2 (diff) |
Uses disqus static plugin
Diffstat (limited to 'plugins/disqus_static/README.rst')
-rw-r--r-- | plugins/disqus_static/README.rst | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/plugins/disqus_static/README.rst b/plugins/disqus_static/README.rst new file mode 100644 index 0000000..77cc5fa --- /dev/null +++ b/plugins/disqus_static/README.rst @@ -0,0 +1,60 @@ +Disqus static comment plugin for Pelican +==================================== + +This plugin adds a disqus_comments property to all articles. +Comments are fetched at generation time using disqus API. + +Installation +------------ +Because we use disqus API to retrieve the comments you need to create an application at +http://disqus.com/api/applications/ which will provide you with a secret and public keys for the API. + +We use disqus-python package for communication with disqus API: +``pip install disqus-python`` + +Put ``disqus_static.py`` plugin in ``plugins`` folder in pelican installation +and use the following in your settings:: + + PLUGINS = [u"disqus_static"] + + DISQUS_SITENAME = u'YOUR_SITENAME' + DISQUS_SECRET_KEY = u'YOUR_SECRET_KEY' + DISQUS_PUBLIC_KEY = u'YOUR_PUBLIC_KEY' + +Usage +----- + +.. code-block:: html+jinja + + {% if article.disqus_comments %} + <div id="disqus_static_comments"> + <h4>{{ article.disqus_comment_count }} comments</h4> + <ul class="post-list"> + {% for comment in article.disqus_comments recursive %} + <li class="post"> + <div class="post-content"> + <div class="avatar hovercard"> + <img alt="Avatar" src="{{ comment.author.avatar.small.cache }}"> + </div> + <div class="post-body"> + <header> + <span class="publisher-anchor-color">{{ comment.author.name }}</span> + <span class="time-ago" title="{{ comment.createdAt }}">{{ comment.createdAt }}</span> + </header> + <div class="post-message-container"> + <div class="post-message publisher-anchor-color "> + {{ comment.message }} + </div> + </div> + </div> + </div> + {% if comment.children %} + <ul class="children"> + {{ loop(comment.children) }} + </ul> + {% endif %} + </li> + {% endfor %} + </ul> + </div> + {% endif %} |