dancing penguin

home page logo

[Home] [Chess] [Gallery] [Links] [Linux] [GPG Key] [eBooks]

Bruno, long time ago

Categories...
Archives...
Sat, 04 Jan 2003 Blosxom 0+5i setup

I am using Blosxom (version 0+5i). As I needed a special setup (more than one weblog per page, SSI includes for header/footer, etc...), I could not use Blosxom as a "page generator", but only as an "article manager" inside an outside page.

I made the following to make it work:

  • First, in my html index file (server parsed), I included the following:
       <!-- I call blosxom.cgi with the parameters.
            If none, the default "/blog/diary" is used -->
       <!--#set var="BLOSXOM_CATEGORY" value="/blog/diary" -->
       <!--#if expr="$DOCUMENT_PATH_INFO" -->
         <!-- #set  var="BLOSXOM_CATEGORY" value="${DOCUMENT_PATH_INFO}" -->
       <!--#endif -->
       <!--#set var="PROGRAM" value="/cgi/blosxom.cgi${BLOSXOM_CATEGORY}" -->
       <!--#set var="RSS_PROGRAM" value="${PROGRAM}/?flav=rss" -->
    
    Then I use the PROGRAM and RSS_PROGRAM variables as following:
       [...]
       <a href="<!-- #echo var="RSS_PROGRAM" -->">
          <img src="/images/xml.gif" alt="Syndicate this site!" />
       </a>
       [...]
       <!--#include virtual="$PROGRAM" -->
       [...]
    
    The target is to generate the correct Blosxom path, and to have a default "/blog/diary" one if none is specified.
  • I also needed to create a .htaccess file in the directory where the index.html resides, to force an http redirection to the index.html if only the directory is specified in the URL. This is necessary, as only URL like http://www.raoult.com/diary/index.html/path/to/weblog will work (and not http://www.raoult.com/diary//path/to/weblog).
       DirectoryIndex redirect.html index.html index.shtml
       Redirect /diary/redirect.html http://www.raoult.com/diary/index.html
    
  • Then, I added the following line in blosxom.cgi, to handle possible "//" (slash slash) between the $url & $path macros:
       $url =~ s/^included:/http:/; # Fix for Server Side Includes (SSI)
       my @pi = split m{/}, path_info();
       shift @pi;
    
       ########## br, to skip initial // (SSI pb)
       $pi[0] eq '' and shift @pi;
    
       my $pi_bl = '';
       while ($pi[0] =~ /^[a-zA-Z]\w*$/) { $pi_bl .= '/' . shift @pi; }
    
  • As I don't want to use the <span> tag as a date separator, I commented out the corresponding lines:
       # $content_type eq 'text/html' && $curdate ne "$dw, $da $mo $yr" && 
       # print span({-class=>'blosxomDate'}, $curdate = "$dw, $da $mo $yr"); 
    
  • Finally, I run a hourly cronjob to generate the weblog index file:
       #/bin/sh
       # find the directory tree and build a list...
       #
       find blog -type d -print | awk '
       BEGIN {
            URL = "http://www.raoult.com/diary/index.html/"
            print "<div class=\"list\">";
            print "<div class=\"listtitle\">";
            print "Weblog tree...";
            print "</div>";
            print "<ul>";
       }
       {
            printf("<li><a href=\"%s%s\">%s</a></li>\n", URL, $0, $0);
       }
       END {
            print "</ul>";
            print "</div>";
       }' > tree.dat
    
    This file is included in the index.html file as:
       <!--#include virtual="/blosxom/tree.dat" -->
    

That's all folks!!

[/technical/website] | permanent link | Google this