dominoGuru.com
Your Development & Design Resource
Google +1 on Traditional Lotus Notes Domino and XPages
07/07/2011 05:30 PM by Chris Toohey
I wonder that you will still be talking, Signior Benedick, no one marks you.
(Fun Fact: I played Signior Benedick in high school...)
Like I did with the Facebook Like add-on -- which allows you to easily share content from around the web with your Facebook friends -- I've added the Google+ +1 add-on both to the individual post Form and to the Views delivering content for this site.
The How to is fairly well documented and easy enough to do.
Since this site is still run using traditional IBM Lotus Notes Domino Design Elements, there was really nothing to it:
Step 1: Grab the JavaScript!
I opted to add the remote Script Library request to a Subform which houses the footer markup on my site (as suggested, right before the closing of the BODY Element). I did this to allow the screen to paint the site before it has to request the remote Javascript resource from Google.
Step 2: Use the plusone
tags... with
Permalinks
From the Column Value Formula of my Pages View:
+ "<div
class=\"gplike\"><g:plusone
href=\"" + url + "\"></g:plusone></div>" +
url in the above example is the permalink address for the individual blog post, and the resulting markup looks like this:
... and that's it really. Now, there's a +1 at the bottom of every post and across each section/collection of posts.
If I were adding this to an XPage however...
The g:plusone
Tag would be problematic if entered as pass-thru
HTML in the XPages Source Pane.
In fact, you'll get a build error that it can't find the g prefix, and I expected that.
You can return the Tag (and include the URL if you're so inclined) using an
xp:text
Control:
<xp:text escape="false" styleClass="">
<xp:this.value><![CDATA[#{javascript:"<g:plusone></g:plusone>&q
uot;}]]>
</xp:this.value>
</xp:text>
Resulting in the following markup:
Alternately, if you don't care about the Permalink, you can just use the
tagName attribute of the xp:text
Control:
<xp:text
escape="false"
tagName="g:plusone"
styleClass="">
</xp:text>
... resulting in the following markup:
<g:plusone class=""></g:plusone>
Either way, there are options there that will allow you to quickly and easily add Google +1 to your Traditional IBM Lotus Notes Domino and XPages-based sites... without the need to write your own components.
(Which I still might do... but this'll do for now!)
With that, Google's new +1 is on the site, so CLICK IT FOR GLORY!