4

How can I implement Google+ comments into Craft CMS?

  • 1
    I wouldn't use Google+ (baring some strange requirement). Having tested Google+, Facebook and Disqus we get way more mileage out of Disqus. I think this has to do with the way content is shared. When commenting on Facebook or Google+ the network effect is far more limited than the content discovery we have been able to leverage from Disqus. Luckily, pretty complete disqus instructions are available at the craft website. Hope this makes sense. – David A McInnis Jan 7 '15 at 20:34
6

This is a bit tricky, and there may be some tradeoffs that I'm unaware of, but the following code works for me:

<script src="https://apis.google.com/js/plusone.js"></script>

<div style="width:100%">
  <div class="g-comments"
       data-href="{{ entry.url }}"
       data-width="675"
       data-first_party_property="BLOGGER"
       data-view_type="FILTERED_POSTMOD">
  </div>
</div>

Two things to note about the code above.

  1. You want to pass the url that will be associated with the comments to the data-href attribute. The example above assumes you are on a page where {{ entry.url }} is the value you want.

  2. The line that references BLOGGER is required: data-first_party_property="BLOGGER"

I can't explain why that is, but the odd specificity of it may also be a reason why this isn't an easy thing to figure out how to do, as it may suggest this is an unsupported method of adding Google Comments to your site or that the method to add Google Comments to your site will change at some point.

In my searches however, this was the only method I found to do it at all and it seems to be used by several people and work just fine at the time of this post.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.