skip to main content.

today, i've added two new plugins to nikola: sidebar and static tag cloud. these, together with filetreesubs, a doit-based file tree synchronization and text-based substitution tool, allow to use nikola to create a more dynamic-looking blog with a sidebar having current information, without the need to rebuild every single page every time something changes. (which can take a very long time for a large blog such as spielwiese).

the plugins create html fragments and, for the tag clouds, css files, which have to be included in all generated blog pages. one way to do this is to use javascript, but that wouldn't yield a proper static blog as i imagine it. the sidebar and the tag cloud should always be there, and not depend on javascript being enabled. (i for myself use noscript and javascript in my browser is off by default.)

for spielwiese, a small tag cloud is created (one per language) and included in the sidebar. a large tag cloud is created and included in the tag overview page (chde version). also, a small and large place cloud is created and included in the sidebar and place overview page, respectively.

the configuration for the static tag cloud plugin looks as follows:

RENDER_STATIC_TAG_CLOUDS = {
    # Small tag cloud
    'small': {
        'name': 'tcs-{0}',
        'filename': 'tagcloud-{0}.inc',
        'taxonomy_type': 'tag',
        'style_filename': 'assets/css/tagcloud-{0}-small.css',
        'max_number_of_levels': 15,
        'max_tags': 40,
        'minimal_number_of_appearances': 5,
        'colors': ((0.4,0.4,0.4), (1.0,1.0,1.0)),
        'background_colors': ((0.133, 0.133, 0.133), ),
        'border_colors': ((0.2, 0.2, 0.2), ),
        'font_sizes': (6, 20),
        'round_factor': 0.6,
    },
    # Large tag cloud
    'large': {
        'name': 'tcl-{0}',
        'filename': 'tagcloud-{0}-large.inc',
        'taxonomy_type': 'tag',
        'style_filename': 'assets/css/tagcloud-{0}-large.css',
        'max_number_of_levels': 100,
        'minimal_number_of_appearances': 3,
        'colors': ((0.25,0.25,0.25), (1.0,1.0,1.0)),
        'background_colors': ((0.133, 0.133, 0.133), ),
        'border_colors': ((0.2, 0.2, 0.2), ),
        'font_sizes': (8, 35),
        'round_factor': 0.3,
    },
    # Small place cloud
    'places-small': {
        'name': 'pcs-{0}',
        'filename': 'placecloud-{0}.inc',
        'taxonomy_type': 'place',
        'style_filename': 'assets/css/placecloud-{0}-small.css',
        'max_number_of_levels': 15,
        'max_tags': 40,
        'minimal_number_of_appearances': 3,
        'colors': ((0.4,0.4,0.4), (1.0,1.0,1.0)),
        'background_colors': ((0.133, 0.133, 0.133), ),
        'border_colors': ((0.2, 0.2, 0.2), ),
        'font_sizes': (6, 20),
        'round_factor': 0.6,
    },
    # Large place cloud
    'places-large': {
        'name': 'pcl-{0}',
        'filename': 'placecloud-{0}-large.inc',
        'taxonomy_type': 'place',
        'style_filename': 'assets/css/placecloud-{0}-large.css',
        'max_number_of_levels': 100,
        'minimal_number_of_appearances': 2,
        'colors': ((0.25,0.25,0.25), (1.0,1.0,1.0)),
        'background_colors': ((0.133, 0.133, 0.133), ),
        'border_colors': ((0.2, 0.2, 0.2), ),
        'font_sizes': (8, 35),
        'round_factor': 0.3,
    },
}

the generated css file for the large tag cloud can be found here; the generated html fragments aren't uploaded as filetreesubs doesn't copy them to the output folder.

the configuration for filetreesubs looks as follows:

source: output-spielwiese
destination: final-spielwiese

# Substitutions
substitutes:
  # For all HTML pages: include sidebar
  '.*\.html':
    '<!-- include:sidebar-en -->':
      file: sidebar-en.inc
    '<!-- include:sidebar-chde -->':
      file: sidebar-chde.inc
  # For specific pages, also include tag/place clouds
  'tag/index.html':
    '<!-- include:tagcloud:en:large -->':
      file: tagcloud-en-large.inc
  'place/index.html':
    '<!-- include:placecloud:en:large -->':
      file: placecloud-en-large.inc
  'chde/schlagwort/index.html':
    '<!-- include:tagcloud:chde:large -->':
      file: tagcloud-chde-large.inc
  'chde/ort/index.html':
    '<!-- include:placecloud:chde:large -->':
      file: placecloud-chde-large.inc

# The substitution chains allow the sidebar to include
# the small tag and place clouds.
substitute_chains:
- template: sidebar-en.inc
  substitutes:
    '<!-- include:tagcloud:en -->':
      file: tagcloud-en.inc
    '<!-- include:placecloud:en -->':
      file: placecloud-en.inc
- template: sidebar-chde.inc
  substitutes:
    '<!-- include:tagcloud:chde -->':
      file: tagcloud-chde.inc
    '<!-- include:placecloud:chde -->':
      file: placecloud-chde.inc

# Create index.html files in all folders which don't have one yet.
create_index_filename: index.html
create_index_content: |
  <!DOCTYPE html>
  <html lang="en">
    <head>
      <title>there's nothing to see here.</title>
      <meta name="robots" content="noindex">
      <meta http-equiv="refresh" content="0; url=..">
    </head>
    <body style="background-color:black; color:white;">
      <div style="position:absolute; top:0; left:0; right:0; bottom:0;">
        <div style="width:100%; height:100%; display:table;">
          <div style="display:table-cell; text-align:center; vertical-align:middle;">
            there's nothing to see here. go <a href=".." style="color:#AAA;">here</a> instead.
          </div>
        </div>
      </div>
    </body>
  </html>

# Everything is UTF-8.
encoding: utf-8

# I want to be able to run different things in parallel.
doit_config:
  dep_file: '.doit-spielwiese-subs.db'

this allows me to use html-style comments such as <!-- include:tagcloud:en --> to indicate where the html fragments should be included. i also create index files in foldes which otherwise would be empty, such as /photos/ (see here for how it looks). the result is, from my point of view, a much more polished version of the blog than the raw version produced by nikola without postprocessing.

this should give you an idea on how to produce a similar result with nikola, my plugins and filetreesubs.

posted in: www
tags:
places:

on new year's day, we enjoyed a peaceful stroll through the nearby forest.

after visiting the gotthard base tunnel, we continued to bellinzona to enjoy the rest of the day. in ticino, it was sunny as opposed to the fog north of the gotthard! we visited the castelgrande, explored the old town and had some nice thick hot chocolate and marroni cake.

on friday, we took the special train gottardino through the new gotthard base tunnel, where we had a chance to explore parts of the sedrun underground station which will in the future only be available for emergency stops.

first, we took a boat tour from lucerne to flüelen. the weather in the german part of switzerland wasn't very awesome, but we got some nice cloudly looks.

in flüelen we boarded the gottardino, which took us into the mountain to the sedrun station. the station had a lot of information material and a film about the base tunnel. it was around 30 degrees centigrade, and so pretty enjoyable in a t-shirt.

after a 45 minutes stopover, we finally continued via train to the south gate of the tunnel and stopped in biasca, where we left the train with some souvenirs:

the south shore of nova scotia has some beautiful and/or funny gems. on the beautiful side, there's the the hawk beach almost at the southern tip of nova scotia.

on the funny side, there are west berlin and east berlin, two little communities originally named "blueberry" and "pudding pan".

on the very touristic side is peggy's cove. in fact, it is so touristic that it is swamped by busloads of tourists. we ended up just taking a quick look and then driving away, and exploring its surroundings instead. there's a lot of very beautiful nature around it!

finally, we saw lunenburg, another historic town, currently hosting the bluenose ii sailing ship.

brier island is the westernmost point of nova scotia, a place you can only reach by taking two ferries. it has a beautiful harbor and features whale wathching tours, where we were finally able to see some whales, in this case humbpack whales. humpback whales are so majestic, except that their blow stinks ;)

further west we visisted the burntcoat head park, adjacent to the bay of fundy, where the highest tidal range was measured with a mean spring range of 14.5 meters and a maximum of 16.3 meters. on low tide you can walk on the ocean floor and see the coastline many meters above you. it's really amazing!

on the west coast of minas basin we had another chance to walk on the ocean floor while the water was retreating. opposed to the mudflats in northern germany, the ground here is more rocky and you can easily follow the water without ruining your shoes completely.

this area belongs to the annapolis valley, which is a very fertile and green landscape with a lot of agriculture, in particular apple orchards. you can also find a lot of wild apple in the area, for example in the blomidon provincial park. the area also has nova scotia's only zoo, the oaklawn farm zoo, featuring a large variety of animals, including several big cats, three of which (cougar, jaguar, siberian tiger) you can see below.

the topmost tip of nova scotia is cape breton island, connected to the mainland by the canso causeway. on it, the cape breton highlands national park can be found, which is crossed by the cabot trail. we spent some time in the town of bay st. lawrence at the northern tip of the island.

we tried a whale watching tour in bay st. lawrence, but unfortunately weren't able to see any whales. what we did see were some northern gannets and seals, though:

back on the mainland we visited arisaig northumberland shore, a provincial park with old stone formations and some fossils.