[TW5] How can I embed an image into the header of each tiddler? (to implement a hit-counter)

134 views
Skip to first unread message

Gesundelehre

unread,
Feb 15, 2017, 12:34:20 PM2/15/17
to TiddlyWiki
Can someone maybe help me doing this?

It would be great if also i could activate/deactivate this option - because i want to embed a hitcounter-image (statcounter) but only when I export all tiddlers to separate files via node.js
If i have the single html-file i only need one hitcounter-image to be loaded at startup to count how many people visit my tiddlywiki.

Thanks for any help
Greetings

Tobias Beer

unread,
Feb 18, 2017, 6:24:45 AM2/18/17
to tiddl...@googlegroups.com
Hi Gesundelehre,

This may help:


You can then do something like

<$vars env=<<sysinfo env>>>
<$list filter="[
<env>prefix[node]]">
only show under node, e.g. when rendering static pages
</$list>
</$vars>


Best wishes,

Tobias. 

Gesundelehre

unread,
Feb 18, 2017, 6:37:09 AM2/18/17
to TiddlyWiki
@Tobieas Beer

is the code you just attached something that i can just copy paste to somewhere? If so, where do i need to enter this code?
Also, is the word "env" in the code a placeholder for something else or do i not need to replace it with something else?

Thanks for your help

Gesundelehre

unread,
Feb 18, 2017, 6:56:39 AM2/18/17
to TiddlyWiki
@Tobias Beer

I now understood the use of the <<sysinfo env>>-macro so i can conditionally embed something only if it is being rendered in the browser or node.
However, how do i make sure the thing that i want to embed is embedded into every single tiddler?

Should i just try to create a filter for all my tiddlers, in which i would like to embed something and then conditionally add it to the ViewTemplate like described here (http://tobibeer.github.io/tb5/#Conditional%20ViewTemplate%20Section) ?

Thanks

Tobias Beer

unread,
Feb 18, 2017, 10:34:04 AM2/18/17
to TiddlyWiki
Hi Gesundelehre,
 
Should i just try to create a filter for all my tiddlers, in which i would like to embed something and then conditionally add it to the ViewTemplate like described here (http://tobibeer.github.io/tb5/#Conditional%20ViewTemplate%20Section) ?

That's precisely right. ;-)

Best wishes,

Tobias.
Reply all
Reply to author
Forward
0 new messages