62 lines
2.0 KiB
ReStructuredText
62 lines
2.0 KiB
ReStructuredText
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.
|
|
|
|
Put ``disqus_static.py`` plugin in ``plugins`` folder in pelican installation
|
|
and use the following in your settings::
|
|
|
|
PLUGINS = [u"pelican.plugins.disqus_static"]
|
|
|
|
DISQUS_SITENAME = u'YOUR_SITENAME'
|
|
DISQUS_SECRET_KEY = u'YOUR_SECRET_KEY'
|
|
DISQUS_PUBLIC_KEY = u'YOUR_PUBLIC_KEY'
|
|
|
|
Usage
|
|
-----
|
|
|
|
Example use of the comments in templates:
|
|
.. code-block:: html+jinja
|
|
|
|
{% if article.disqus_comments %}
|
|
<div id="disqus_static_comments">
|
|
<h4>{{ article.disqus_comments|length }} comments</h4>
|
|
<ul class="post-list">
|
|
{% for comment in article.disqus_comments %}
|
|
<li class="post">
|
|
<div data-role="post-content" 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" data-role="message-container">
|
|
<div data-role="message-content">
|
|
<div class="post-message publisher-anchor-color " data-role="message">
|
|
{{ comment.message }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
|
|
TODO
|
|
-----
|
|
|
|
- handle replies to comments properly and maintain parent-child relationships
|
|
- test for sites with over 100 comments (I think disqus API only returns 100 items per request)
|