Google +1 Button for Pebble Blog

You basically need to change 2 files to add the Google +1 button to the Pebble Blog.

First, add the Google +1 button javascript code at the end of your favorite template. This should be located somewhere around themes/your-theme/template.jsp

<script type="text/javascript" src="https://apis.google.com/js/plusone.js">
</script>
<script type="text/javascript">
   (function() {
      var po = document.createElement('script');
      po.type = 'text/javascript'; po.async = true;
      po.src = 'https://apis.google.com/js/plusone.js';
      var s = document.getElementsByTagName('script')[0];
      s.parentNode.insertBefore(po, s);
   })();
</script>

Second, set the button tag within the entry Java server page. So it does appears right behind the title of each blog entry. You will find the file in WEB-INF/jsp/blogEntry.jsp

<h1>
<a href="${blogEntry.permalink}">${blogEntry.title}</a>&nbsp;
<g:plusone size="small" href="${blogEntry.localPermalink}"></g:plusone>

</h1>

Advertisement

Enforce Status Code 301 using mod_rewrite

Common Apache rewrite rules do 302 Moved Temporarly redirects which cause spiders such as Google to fail indexing. Common redirect (status code 302)
RewriteEngine On
RewriteRule ^/$ /anypage.html [L,R]

You must return error code 301 to gain the spider’s favour. Therefore, the mod_rewrite configuration directive must be adjusted appropriately. Permanent redirect (status code 301)
RewriteEngine On
RewriteRule ^/$ /anypage.html [L,R=301]
 

Do not get confused by the L flag it just marks that rule as the last rule to be processed and does not affect the redirect behavior.