Skip to main content

Adding a New Plugin Using the NanoBlogger Framework

·230 words·2 mins·
Julien Gabel
Author
Julien Gabel
Multi-platform UNIX systems administrator and consultant in mutualized and virtualized environments.

— templates/main_index.htm Wed Jul 6 14:49:05 2005 +++ templates/main_index.htm.hardwritten Mon Aug 8 13:12:05 2005 @@ -29,6 +29,10 @@ $NB_Entries </div>

+<div class="side"> +All content herein © 2006, Your Company, Inc. All right reserved. +</div> + <div id="menu"> $NB_PageLinks </div>

  • Or writing a little plugin to do that... (based on the plugins/fortune.sh code)
    # cat << EOF > ${NB_INST_PATH}/plugins/copyright.sh
    # NanoBlogger Copyright plugin.
    
    

    sample code for templates, based off default stylesheet
    #

    #

    <div class="side">
    #

    $NB_Copyright #

    </div>
    #

    PLUGIN_OUTFILE="$BLOG_DIR/$PARTS_DIR/copyright.$NB_FILETYPE"

    nb_msg "generating copyright …" echo ‘<div class="copyright">’ > "$PLUGIN_OUTFILE" echo ‘All content herein © 2006, Your Company, Inc. All right reserved.’ >> "$PLUGIN_OUTFILE" echo ‘</div>’ >> "$PLUGIN_OUTFILE" NB_Copyright=$(< "$PLUGIN_OUTFILE") EOF $ $ diff -u templates/main_index.htm templates/main_index.htm.plugin — templates/main_index.htm Wed Jul 6 14:49:05 2005

    Discussing how to add a copyright notice at each page automatically on the NanoBlogger mailing list, here are the two propositions i can think of.

    It can be done by adding directly the copyright notice in the desired template files (i.e. templates/main_index.htm, etc.):

    1. Either writing it in the corresponding files...

      $ diff -u templates/main_index.htm templates/main_index.htm.hardwritten
      +++ templates/main_index.htm.plugin Mon Aug 8 13:12:29 2005
      @@ -29,6 +29,10 @@
      $NB_Entries
      </div>
      
      +<div class="side">
      +$NB_Copyright
      +</div>
      +
      <div id="menu">
      $NB_PageLinks
      </div>
      

    The advantage of the second proposition is the capability to add a general feature using the NanoBlogger framework, and the use of the CSS to modify the new copyright class.