first implementation of google plus comments
This commit is contained in:
20
googleplus_comments/Readme.md
Normal file
20
googleplus_comments/Readme.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
GooglePlus Comments Plugin For Pelican
|
||||||
|
==================================
|
||||||
|
|
||||||
|
Adds GooglePlus comments to Pelican
|
||||||
|
|
||||||
|
Add the plugin to `pelicanconf.py`:
|
||||||
|
|
||||||
|
PLUGIN_PATH = 'pelican-plugins'
|
||||||
|
PLUGINS = ["googleplus_comments"]
|
||||||
|
|
||||||
|
Add a `<div>` for comments to the `article.html` of your template:
|
||||||
|
|
||||||
|
<div id="commentswrap">
|
||||||
|
<div id="comments"></div>
|
||||||
|
</div>
|
||||||
|
{{ article.metadata.googleplus_comments }}
|
||||||
|
|
||||||
|
See it working, and ask for support:
|
||||||
|
|
||||||
|
<http://zonca.github.io/2013/09/google-plus-comments-plugin-for-pelican.html>
|
||||||
1
googleplus_comments/__init__.py
Normal file
1
googleplus_comments/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from .googleplus_comments import *
|
||||||
29
googleplus_comments/googleplus_comments.py
Normal file
29
googleplus_comments/googleplus_comments.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Google Comments Plugin For Pelican
|
||||||
|
==================================
|
||||||
|
|
||||||
|
Adds Google comments to Pelican
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pelican import signals
|
||||||
|
|
||||||
|
googleplus_comments_snippet = """
|
||||||
|
<script src="https://apis.google.com/js/plusone.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
gapi.comments.render('comments', {
|
||||||
|
href: window.location,
|
||||||
|
width: '600',
|
||||||
|
first_party_property: 'BLOGGER',
|
||||||
|
view_type: 'FILTERED_POSTMOD'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
"""
|
||||||
|
|
||||||
|
def add_googleplus_comments(generator, metadata):
|
||||||
|
metadata["googleplus_comments"] = googleplus_comments_snippet
|
||||||
|
|
||||||
|
def register():
|
||||||
|
signals.article_generator_context.connect(add_googleplus_comments)
|
||||||
Reference in New Issue
Block a user