[This presumes you've been following my saga on using TW5 as a static 
blogging engine replacement.]

So, one of my beefs has been that tag buttons on static pages are "given 
the finger," that is, the mouse pointer indicates they're clickable but 
clicking on them doesn't do anything because the navigation logic has been 
stripped (since the static site, by definition, doesn't have all the chewy 
goodness of the TW script environment). I think that is bad behavior. I 
could change the static CSS, obviously, but really, I *do *want the tags to 
be clickable.

I had originally thought of trying to update the static template to 
override the tag *<button> *elements output for each tiddler with *<a> 
*elements 
that are styled the same as the buttons, but I got lost in the forest of 
macros, templates, inclusions and whatnot. I still think ultimately that is 
the way to go (especially if by "static" you mean "pure HTML/CSS with no 
Javascript, although that is not necessarily what I mean as I pursue this 
project - I will almost assuredly use some scripting in the output).

In the interim I have cheated, as follows:

1. For every tag where I want this clickable behavior (which doesn't 
include the "toc" tag, for example, for tagging things that I want in the 
TOC), I have created a tiddler with the same name, e.g., for the "tech" tag 
there is a tiddler named "tech" that has the following content:

<<list-links filter:"[tag[tech]]">>

2. I have also created a "Categories" tiddler that I use in the sidebar TOC 
to have a quick jump to a list of *all *the tag pages. Its contents:

<<list-links filter:"[is[tag]]">>

3. You can already see all this in action on my site <http://dullroar.com>. 
Nothing new there since my last post.

4. The thing I added in my local testing today was the following to the 
bottom of my override of *$:/core/templates/static.tiddler.html*. The new 
content is what I inserted between the closing *</body> *and *</html>* HTML 
tags:

`</body>
<script src="http://code.jquery.com/jquery-1.11.2.min.js";></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js";></script>
<script>$(document).ready(function() {
  $("button.tc-tag-label").on("click", function() {
    window.location.href = $(this).text().trim()+".html";
  });
});
</script>
</html>
`

It ain't the TW way, I know, but it *does *work. It simply requires there 
to be a static HTML page generated per tag (see #1).

*Note: *I added the "http:" to the front of each link to the jQuery CDN 
because otherwise it doesn't load the libs when you're testing by just 
clicking on the generated static *.html *files in your local file system 
(as opposed to running them under a web server). In "production" I will go 
back to just the "//code.jquery.com/jquery-1.11.2.min.js" style URLs 
preferred by the jQuery site 
<http://jquery.com/download/#using-jquery-with-a-cdn>, because that will 
help serve it with no warnings whether my site is being access via HTTP or 
HTTPS.

Anyway, I thought I would share my progress (which hasn't been much of 
late, due to other demands on my time). Comments appreciated, especially 
pointing to what would be a more TW-compliant way to get what I want out of 
the static template.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to