Sat Mar 27 02:53:28 CET 2010

nanoblogger: navigation bar always visible

I wanted the navigation bar (the thing on the left with "articles", "categories" etc.) on this homepage to be visible also for archive pages and permanent links. This is how to convince nanoblogger to do it.

All paths are relative to $BLOGDIR. From the file templates/main_index.htm copy the whole <div id="link"> block into a file z001_navigationbar.sh. Move this file into the directory plugins/page and edit it as follows:

plugins/page/z001_navigationbar.sh
NAVIGATION_BAR="
        <div id=\"links\">
            <!-- weblog_links.sh -->
            <div class=\"sidetitle\">
                $template_links
            </div>
            <div class=\"side\">
                $NB_MainLinks
            </div>
            .
            .
            .
        </div><!-- /links div -->
"

Note how all double quotes in the XHTML code have to be escaped, because the <div id="links"> block is itself enclosed in double quotes and assigned to a variable NAVIGATION_BAR.

In the file templates/main_index.htm replace the navigation bar by the new variable:

templates/main_index.htm
<div id="container">

        $NAVIGATION_BAR

        <div id="content">

In the templates directory, edit the files archive_index.htm, category_archive.htm, day_archive.htm, makepage.htm, permalink.htm and year_archive.htm to include the navigation bar. For example in the file templates/archive_index.htm (and in the other files accordingly) we have to change

templates/archive_index.htm
<div id="container">

        <div class="archives">

        ...

        </div><!-- /archives -->

</div><!-- /container -->

into

templates/archive_index.htm
<div id="container">
    <div id="content">
        <div class="archives">

        ...

        </div><!-- /archives -->
    </div><!-- /content -->
</div><!-- /container -->

It is important to mention that with these modifications, absolute links have to be turned on in blog.conf, otherwise links in the navigation bar will be broken.

blog.conf
# enable absolute links (full path to domain/$BLOG_URL) - 0/1 = off/on.
# defaults to relative links, "0"
# NOTE: depends on $BLOG_URL in order to work properly.
ABSOLUTE_LINKS="1"

Posted by Raimar | Permanent link | File under: gnu_linux
Diese Seiten werden auf einem Server der Universitaet Innsbruck gehostet und unterstehen diesen Richtlinien.