If you are a regular visitor of Shoutmeloud, you would have noticed the addition of Google+ button at the top – embedded with the sticky bar. You’ll find another Google+ button below the post titles as well. It’s important to note that these buttons show different counts. How to enable a similar stuff on your blog? Well, I’ll be explaining the same in this article and I’ll dig a little deep about Google’s obsession with speed on this button.
It’s pretty easy to add the Google+ button on your homepage (or) on the post page of your blog. Just visit the following link and grab the button of your choice and paste the same anywhere on your template or theme. Simple! By default, the script will pick up the URL as found in the DOM. However, I suggest you to add a href attribute to the code. Why because, Google suggests you to do the same. When you read the documentation page of the article, you’ll find the following statement.
If neither the
link rel="canonical"are specified, Google will use the URL of the page as found in the DOM. This can sometimes cause incorrect behavior as the URL in the address bar can contain session IDs or other parameters which are not part of the canonical URL. Therefore, we highly recommend using either the
How do I add the href attribute? Simple. Just mention href=”YOUR URL” along with the <g:plusone/> tag. So, your code should be similar to the one shown below.
The logic is pretty simple! Have the default version of the Google+ button on your post pages so that it picks the URL from the DOM while the button that should +1 the homepage shall be specifically tagged with the href attribute. That’s it!
Well, coming to the speed with which the plus button loads, Google by default is working on the loading speed of the button. You don’t have to make any changes for the same. However, there’s another script that you can include instead of the default version – Asynchronous Loading Script which will load the script much faster than it did before.
Note: Use either the standard version or the script above but not both of them.
To know better about the script, just check out the documentation page here – More about Google+1 button. Well, if your one candidate who is obsessed with page speed, just like Google, then you can use the Asynchronous Script. Else, I suggest you to stick with the default version. Let me know what version do you use via comments and your knowledge about Google+ as well!
Subscribe to Download WordPress Guide Worth $99