bityard Blog

// Add a Google+1 Button to DokuWiki with BlogTNG and the mnml-blog template

How to add a Google+1 Button to a DokuWiki (“Angua” release or later) based blog using the BlogTNG plugin and the mnml-blog template? Here's how:

  • Download the Google +1 plugin and install it. With the DokuWiki release “Angua” or later, the requirement for the external jQuery plugin is not necessary any more. An internally packaged jQuery is part of the DokuWiki standard distribution since that release.

  • Edit the plugin to not register for the external jQuery events any more:

    plugins/googleplusone/action.php
        ...
        function register(&$controller) {
            /* $controller->register_hook( 'JQUERY_READY', 'BEFORE', $this, '_addjs' ); */
            $controller->register_hook( 'TPL_METAHEADER_OUTPUT', 'BEFORE', $this, '_addscript' );
        }
        ...
  • Edit the mnml-blog template to insert the Google+1 Button into the lower right corner, just above the footer defined by blogtng_footer:

    • entry.php for individual blog posts:

      entry.php
      --- entry.php.orig      2012-05-29 23:08:09.000000000 +0200
      +++ entry.php   2012-05-30 00:40:10.000000000 +0200
      @@ -42,6 +42,9 @@
                             //skip header
                             true); ?>
           <div class="clearer"></div>
      +    <div class="sharethis">
      +    <?php global $ID; echo "  <g:plusone href=\"" . wl($this->entry['page'],'',true,'&') . (!empty($anchor) ? '#'.$anchor : '') . "\" size=\"medium\" count=\"true\"></g:plusone>\n";?>
      +    </div>
           <div class="blogtng_footer">
               <div class="level1">
                   <?php $entry->tpl_created("%Y-%m-%d @ %H:%M"); ?> |
    • list.php for the overview of blog posts:

      list.php
      --- list.php.orig       2012-05-29 23:08:12.000000000 +0200
      +++ list.php    2012-05-30 00:11:03.000000000 +0200
      @@ -45,5 +45,8 @@
                             true);
       ?>
           <div class="clearer"></div>
      +    <div class="sharethis">
      +    <?php global $ID; echo "  <g:plusone href=\"" . wl($this->entry['page'],'',true,'&') . (!empty($anchor) ? '#'.$anchor : '') . "\" size=\"medium\" count=\"true\"></g:plusone>\n";?>
      +    </div>
           <div class="blogtng_footer">
               <div class="level1">
  • Add a Stylesheet for the sharethis Class:

    tpl/mnml-blog/user/screen.css
    .sharethis{
        text-align:right;
        padding:0;
        margin:0;
    }

After the above changes you should now see a Google+1 Button in the lower right corner of each blog post.

// Hello World

Well, the topic says it all. Apart from several test posts this is the first blog post designed to actually stay in this newly created blog. Being a tad late to the whole blogging thing it only seems fitting to choose the odd combination of DokuWiki and the BlogTNG plugin instead of something more mainstream. Other than that it's just that i've grown rather fond of DokuWiki over the past few years, so why not use it for this purpose also.

Although i'm not a nativ english speaker i intend to write in english as sort of an ongoning exercise and to hopefully reach a broader audiance. Therefor i apologize in advance for any bad grammer, strange phrasing and such. Any hints and corrections are greatly appreciated ;-)

Since i consider myself as a bit of a science nerd and computer geek, most of the stuff to be found here will probably be related to those two fields. Dear reader, you've been warned …

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website. More information about cookies