::  Posts  ::  RSS  ::  ◂◂RSS  ::  Contact

External Comment Integration

August 4th, 2011
facebook, googleplus, tech, comments  [html]
For a long time I've crossposted blog entries to facebook (and now google plus) and have avoided needing to implement commenting by letting those serve as discussion fora. I got kind of annoyed with this making the discussion fragmented and decided to fix this. Unfortunately, there's not an api available for google plus yet. So for now I just settled for pulling comments from the facebook api.

If you're interested in the technical details, I needed a pretty roundabout solution because I have two constraints: (1) I don't want people to have to authenticate with facebook or something to see the comments and (2) I can't run any server side code on my blog host. I ended up going with a simple wsgi app that pulls from facebook's graph api with an oauth token in my name, makes it into html, returns "'document.write(%s);' % json.dumps(html)", which is then included into my document with a script tag where I want the comments to show up. I do need to specify the facebook id of the post, instead of it automatically discovering it, but that's not so bad. I was originally planning to use an iframe, but it turns out that including content with an iframe that acts like part of your page instead of independently scrolling is a really hard problem involving lots of javacript and browser workarounds.

So comment away!

Update 2012-03-24: The code, minus facebook access tokens, is now on github.

Comment via: google plus, facebook

Recent posts on blogs I like:

Incoming Gantz-Led Government to Invest in Israel’s Infrastructure

Israel’s incoming prime minister Benny Gantz unveiled an emergency government, to take power following an upcoming confidence vote in the Knesset. The last two MKs required to give Gantz a 61-59 majority, two members of Gantz’s own Blue and White Party wh…

via Pedestrian Observations April 1, 2020

Finding home in the time of coronavirus

Disclaimer: I’m going to say this once. Obviously, I am not happy about the coronavirus’s threat to public health or the economic toll it’s taking. I do not think the existence of this pandemic is good. Just so happens that social distancing and remote wo…

via Holly Elmore March 31, 2020

Massachusetts should shut down immediately

We’ve been running 30x fewer tests than other states, and have been extremely tardy in responding to the Biogen outbreak.

via benkuhn.net March 15, 2020

more     (via openring)

More Posts:


  ::  Posts  ::  RSS  ::  ◂◂RSS  ::  Contact