README.rst 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. Disqus static comment plugin for Pelican
  2. ====================================
  3. This plugin adds a disqus_comments property to all articles.
  4. Comments are fetched at generation time using disqus API.
  5. Installation
  6. ------------
  7. Because we use disqus API to retrieve the comments you need to create an application at
  8. http://disqus.com/api/applications/ which will provide you with a secret and public keys for the API.
  9. Put ``disqus_static.py`` plugin in ``plugins`` folder in pelican installation
  10. and use the following in your settings::
  11. PLUGINS = [u"pelican.plugins.disqus_static"]
  12. DISQUS_SITENAME = u'YOUR_SITENAME'
  13. DISQUS_SECRET_KEY = u'YOUR_SECRET_KEY'
  14. DISQUS_PUBLIC_KEY = u'YOUR_PUBLIC_KEY'
  15. Usage
  16. -----
  17. .. code-block:: html+jinja
  18. {% if article.disqus_comments %}
  19. <div id="disqus_static_comments">
  20. <h4>{{ article.disqus_comments|length }} comments</h4>
  21. <ul class="post-list">
  22. {% for comment in article.disqus_comments %}
  23. <li class="post">
  24. <div data-role="post-content" class="post-content">
  25. <div class="avatar hovercard">
  26. <img alt="Avatar" src="{{ comment.author.avatar.small.cache }}">
  27. </div>
  28. <div class="post-body">
  29. <header>
  30. <span class="publisher-anchor-color">{{ comment.author.name }}</span>
  31. <span class="time-ago" title="{{ comment.createdAt }}">{{ comment.createdAt }}</span>
  32. </header>
  33. <div class="post-message-container" data-role="message-container">
  34. <div data-role="message-content">
  35. <div class="post-message publisher-anchor-color " data-role="message">
  36. {{ comment.message }}
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </li>
  43. {% endfor %}
  44. </ul>
  45. </div>
  46. {% endif %}
  47. TODO
  48. -----
  49. - handle replies to comments properly and maintain parent-child relationships
  50. - test for sites with over 100 comments (I think disqus API only returns 100 items per request)