googleplus_comments.py 776 B

123456789101112131415161718192021222324252627282930
  1. # -*- coding: utf-8 -*-
  2. """
  3. Google Comments Plugin For Pelican
  4. ==================================
  5. Adds Google comments to Pelican
  6. """
  7. from pelican import signals
  8. googleplus_comments_snippet = """
  9. <script src="https://apis.google.com/js/plusone.js"></script>
  10. <script>
  11. $(document).ready(function () {
  12. gapi.comments.render('comments', {
  13. href: window.location,
  14. width: '600',
  15. first_party_property: 'BLOGGER',
  16. view_type: 'FILTERED_POSTMOD'
  17. });
  18. });
  19. </script>
  20. """
  21. def add_googleplus_comments(generator, metadata):
  22. metadata["googleplus_comments"] = googleplus_comments_snippet
  23. def register():
  24. signals.article_generator_context.connect(add_googleplus_comments)