Table of Contents
Upgrading
When upgrading nanoblogger, there's three basic things that need to be considered, and they are: archives, templates, and configuration. These are the three things that should be backed up and may require some minor adjustments before they work well with the new version. Here are some steps you can take to help ease the transition.cat, cp, cut, date, expr, grep, mkdir, read, rm, sed, sort, touch, trap
For online publishing you'll need some kind of shell or FTP access to your web server.
nb [-b blogdir] [options]Try "nb --help" for all available options. For each blog there's a user defined configuration file called "blog.conf". This file controls the behavior of a blog. It allows you to change such things as, how many entries to display on the front page. It's also where you set the title, description, and the URL for your blog. The DATE_FORMAT variable can be customized to change the date format of a new entry. The default DATE_FORMAT uses "%B %d, %Y %l:%M %p" and produces something like this: "August 05, 2003 12:53 AM". Read the man pages of the date command to see more on how to customize the format of a date.
NanoBlogger creates the following web pages:
The web pages are regenerated each time you add, edit, or delete an entry.
- index.html
- index.rdf
- archives/cat_[N].html (only when categories exist)
- archives/monthly/[YYYY-MM].html
- archives/permalinks/[YYYY-MM-HH_MM_SS].htm (only when full permalinks are enabled)
Enabling full permalinks, causes each entry to have it's own web page. To enable full permalinks in your blog, edit blog.conf and set FULL_PERMALINKS equal to 1. Make sure that the permalinks have been generated, you may have to rebuild your blog. The entries' permalinks should've automatically been changed, if you experience any problems, have a look at the "entry.htm" template. Look at the "href" line and make sure that it's only set to equal "$NB_EntryPermalink". If it's not then change it and rebuild your blog again.
The blog's appearance is controlled by the following templates: templates description archive.htm controls look of the master archive page archive_links.htm controls look of the master archive links category.htm controls look of the categories pages category_links.htm the links to the categories entry.htm controls look of your blog entries entry_links.htm controls look of the entry links entrycat_links.htm controls look of the entry category links main_index.htm controls look of the blog's main page main_links.htm contains user defined links makepage.htm default template used by makepage option month_archive.htm controls look of the monthly archive pages month_links.htm controls look of the monthly archive links permalink.htm controls look of the permalink pages permalink_entry.htm controls look of a blog entry within a permalink page rdf_entry.xml controls look of each individual news item in the rss feed rdf.xml controls look and format of rss feed (index.rdf)
In addition there's a stylesheet called, "blog_style.css".
All the placeholders are reinterpreted by the shell as variables when a template is sourced, making the templates capable of a few shell scripting tricks themselves. As a simple example, you could place this in your template: "Last Modified: `date`", and it would display the time your page was last modified, using the date command. Thus greatly enhancing the power of the templates, making it possible to create your own script and replace my "Last Modified" example with your own script.
The entry template includes the following placeholders: placeholders description $NB_EntryAuthor author of entry $NB_EntryCategories entry's category links $NB_EntryBody entry's content $NB_EntryDate entry's posted time $NB_EntryID entry's id $NB_EntryPermalink entry's permalink $NB_EntryTitle entry's title
The main template includes the following placeholders: placeholders description $BLOG_CHARSET blog's character set $BLOG_CONTACT blog's contact info $BLOG_DESCRIPTION blog's description $BLOG_TITLE blog's title $BLOG_URL blog's URL $NB_Archive_Links links to archives $NB_Category_Links links to categories $NB_Main_Links user defined links $NB_Entries all the current entries
Format of an Entry
The entry format is made up of pieces of metadata. Each piece of metadata is of the format KEY: VALUE, then a carriage return that separates one piece from the next. The order of the metadata pieces is not important.Example:
TITLE: A New Entry
AUTHOR: foo
DATE: January 30 2004, 12:00 PM
-----
BODY:
This is my new entry ...
-----
To disable a plugin, rename the plugin's extension from ".sh" to ".off". This will move the plugin off of the radar, the next time NanoBlogger is run.
The plugins included and what placeholders they create (most are enabled by default and setup in the templates): plugins description placeholders special requirements archive/monthly_cal.sh adds a calendar with links to each monthly archive $NB_Monthly_Calendar cal autoformat/auto_break.sh adds paragraph breaks to blank lines of entries $NB_EntryBody none autoformat/moods.sh adds ability to use mood variables inside a blog's entry $NB_EntryBody copy moods directory to blog's directory blog_status.sh generates blog statistics $NB_Blog_Status none calendar.sh adds a calendar with links based on the current month $NB_Calendar cal fortune.sh uses fortune to generate random quotes $NB_Fortune fortune list_entries.sh generates list of entries recent or old $NB_Recent_Entries, $NB_Older_Entries none mymood.sh adds ability for user to set a mood status in their blog $NB_My_Mood copy moods directory to blog's directory postformat/tidy.sh validates HTML code $NB_Tidy HTML tidy
Update your blog quickly with the "--update main" option. This option skips the processing of entries and is great for making quick changes to the main page when you don't have any new entries. e.g. use "nb -u main myblog" to just update the calendar
To add an introduction, create a text file in your blog called, "intro.txt". Edit the text file to say what you want, then add the following to the main template:
‘cat "$BLOG_DIR"/intro.txt‘
Note the use of left single quotes, they're important. Also, note that no processing is being done this way, you have to add your own HTML.Remember the "clippings" feature? Say you already have a web site full of your own custom server-side scripts/includes. This is where the "news.htm" file comes in. It contains all the current entries, so adding a news/diary/blog section is just a matter of adding the code to include "news.htm" into the page. So, now you can have a simple blog-like page, that's updated whenever news.htm changes.
If the WEB_BROWSER you set is being overridden and this is undesirable, check for the environment variable, BROWSER. This is standard on Debian systems and takes precedence over your WEB_BROWSER setting. As a workaround, make sure that BROWSER is set to the web browser you want to use or replace WEB_BROWSER with BROWSER in the blog's config file, "blog.conf". The same could apply for the TXT_EDITOR variable as well.
Adding Comment support to Your Blog
There's many ways you could accomplish this, but I chose to go with a perl based solution, because most web server's already support it. The program I found is called CGIComment [2] and was easy to integrate into my blog. The cool thing about CGIComment is it's ability to append comments to any HTML document. Here are the steps to enable comments:When you have comments working you can download my modified set of CGIComment templates[1] that have been designed to integrate with NanoBlogger's default stylesheets.