Langsung ke konten utama

Adding A Google+ Badge To Blogger (Updating My Blogger Template)

Adding a Google+ badge to our Blogger templates enables readers to easily connect with our Google+ page. This can be achieved in just a few simple steps by adding a Google+ Badge gadget; it's also possible to customize the badge and change the display effect.

As part of updating my Blogger template, I added a badge to the sidebar which enables readers to directly connect to the a Google+ Gadget which we can add to our Blogger layouts in just a couple of clicks.

To add this gadget to your layout, click on the Layout link in the left hand side of your dashboard and choose to add a new gadget in the section where you would like it to appear.

Select the Google+ Badge gadget from the list of official gadgets (this currently appears near the very top of the list. You'll need to paste in your Google+ Page ID in the appropriate section of this pop-up window, like this:


Press "enter" to update the preview, and select whether you prefer a light or dark colour scheme. Finally, save your gadget to make your Google+ badge appear in your template layout.

But my Google+ badge doesn't appear!

If you are using an older or customized Blogger template, the javascript code required to render the Google+ badge (and other features) may not be present in your template.

We can fix this by adding a single line of code to our template HTML.

Go to Template>Edit HTML in your Blogger dashboard and search for the opening <head> tag using your browser's search function.

Immediately before this line, paste the following line of code:
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
Now preview your changes. Once the preview has finished loading, you should see your Google+ badge appear in your layout as intended and can save the changes you have made.

Customize your Google+ Badge gadget

To alter the appearance of your Google+ Badge, you'll need to alter the dimensions of the badge within your blog's HTML code. These dimensions are what effect the appearance of the Google+ badge as we can see in these examples provided by Google's documentation:


Since we cannot (yet) change the dimensions of our Google+ badge through the gadget's settings, we must do this by editing our template code.

Go to Template>Edit HTML and be sure to check the "Expand Widget Templates" box. Then search for the following line of code (or similar):
  <g:plus expr:href='"https://plus.google.com/" + data:profileId' expr:theme='data:theme' height='69' rel='author' width='260'/>
The width specified in the above line may be different in your own template.

We may only specify one of two heights for our Google+ badge: 69 or 131. If any other height is specified, the badge will not work.

By default, the badge gadget specifies the height as 69. If you would prefer to display a taller badge to display the profile pictures of your followers (as I have for this site) you will need to change the height from 69 to 131.

If you would prefer to display the narrow, compact Google+ badge (the third example in the image above), change the height to 131 and the width to 100.

Now preview your template to see how these changes will appear. Once you are happy with the appearance of your badge, save your template and enjoy your customized badge.

Note: the customizations you make to your Google+ badge will not appear in the preview if you edit your gadget. Also, if you choose to remove the gadget and later wish to add another, you will need to make these changes again.

Did you find this tutorial helpful?

I hope you have found this documentation of my update process useful for adding and customizing your own Google+ badge. Please feel free to leave your comments below and don't forget to follow on Google+!

Komentar

Postingan populer dari blog ini

How To Add A Music Player In Blogspot

Since this archived post was written in 2007, web design and Blogger templates have changed immensely. The development of HTML5 and <audio> tags enable us to add music to our Blogspot websites and posts far more simply, and with improved control. In preparation for explaining how to podcast with Blogger, this tutorial explains how to easily add an HTML5 mp3/audio player to your blog posts or layout. No JavaScript, Flash or plugins are required, and with a fallback for older browsers which don't support the player. I've even created a simple form to generate basic tags for you! Adding music to your Blogspot site has never been so easy! Basic HTML5 Audio Tags Explained The <audio> tag is a new feature of HTML5 which we can use to natively embed audio playback in our sites. It is supported in Internet Explorer 9, Firefox, Opera, Chrome, and Safari, and can be set to play the linked audio file automatically (autoplay) or loop if required. Here&#

Import Blogs From Another Service To Blogger With The Google Blog Converters Project

A few months back, Blogger announced the ability to import and export Blogger hosted blogs. At the time, it was not possible to import blogs from any other service to Blogger, which left many of us a little disappointed though wondering when this service could be made available. Well it seems there is hope that Blogger can make such a service available through our Blogger dashboards soon enough! Today the the Google Blog Converters project : an open source project which aims to make available the ability to import/export feeds from many different blog platforms: This new Open Source project provides the ability to easily move blog posts and comments from service to service. This initial release provides Python libraries and runnable scripts that convert between the export formats of Blogger, LiveJournal , MovableType , and WordPress . In addition, the source code includes templates for hosting these conversions on Google App Engine . Future additions to the project will includ

Ebooks - Updated Links

As many readers have reported, the links to download my eBooks had become corrupted during my extended hiatus. Today I have uploaded both The Blogger Template Book and The Cheats' Guide to Customizing Blogger templates to Google Documents, a relocation I hope will prove far more reliable than my previous hosting solution! I've updated the download links for these eBooks and hope everyone can now read and download these resources without any problems. It's been a long time since these eBooks were released, so here's a quick overview of both offerings for new readers and those who may have missed the documentation upon their initial releases: The Blogger Template Book Choosing and using a new template for your Blogger powered blog can be quite a daunting task. What is the best method for installation? How can you choose the design and layout most suitable for your blog? The Blogger Template Book is a free complete guide to Blogger templates, from choos