Building this Website (4. tags)

Friday, May 1, 2015

This is a series of posts which technically describes how Not Even Odd is built.


In TiddlyWiki, tags are highly dynamic but during the static generation, tags turn out as buttons with no action. This thus needs some correcting.

Probing into TiddlyWiki, I figured the displaying of tags is controlled by the shadow tiddler $:/core/ui/TagTemplate(local) (v5.1.8) (current TW).

There, it's not too hard to locate the tag button. I thus I just replaced the button widget

<$button popup=<<qualify "$:/state/popup/tag">> class="tc-btn-invisible tc-tag-label" style=<<tag-styles>>>
<$transclude tiddler={{!!icon}}/> <$view field="title" format="text" />

with a link widget that links to the tiddler corresponding to the tag.

<!-- replacing the tag button with a link -->
<$set name="taglinksto" value={{!!title}}>
  <span class="tc-btn-invisible tc-tag-label" style=<<tag-styles>> >
    <$link to=<<taglinksto>> >
      <$transclude tiddler={{!!icon}}/> <$view field="title" format="text" />

Of course, modifying this shadow tiddler will also affect the TiddlyWiki used for editing this site and we don't really want that. So one solution I use is to create the above modification in a separate file (called static_tags) and then override the tiddler when invoking the static generation (you ought to create a shell script for it)...

# "overriding" shadow tiddler
cp -i static_tags tiddlers/\$__core_ui_TagTemplate.tid

tiddliwiki --rendertiddlers ...     # static generation

rm -f tiddlers/\$__core_ui_TagTemplate.tid    #clean up

This might not be very elegant but it is good enough.

previous: creating the navigation
next: fixing tiddlers' date

Not Even Odd

Musings and mumblings of a random nerd

Last 10 Posts:

Building this Website (8. feed)
Free Software
Building this Website (7. plugins)
Building this Website (6. external files)
Building this Website (5. tiddlers' date)
Building this Website (4. tags)
Building this Website (3. navigation)
Building this Website (2. template)
Building this Website (1. content selection)
Building this Website


see all tags
    All Posts
    (alphabetically | chronologically)

Follow:        ...