How to change ViewTemplate/body for tiddlers with specific tag?

230 views
Skip to first unread message

jos...@poehls.me

unread,
Jan 6, 2021, 10:34:40 PM1/6/21
to TiddlyWiki
Hey guys. I've been trying to figure out how to do this: if my tiddler is tagged "test" (for example), I want the view/render template to have some content appended to it.

I found the $:/core/ui/ViewTemplate/body shadow tiddler but I'm not sure how to add a conditional that says "if the current tiddler has X tag show Y content".

Any pointers? Thanks!

Here's where I've gotten so far, though it isn't working. The <$reveal> element at the end is my attempt.

Screen Shot 2021-01-06 at 9.28.52 PM.png

Mark S.

unread,
Jan 6, 2021, 11:17:50 PM1/6/21
to TiddlyWiki
Generally you don't want to hack a core tiddler, since that will make upgrading difficult.

Usually you would create a tiddler and tag it with $:/tags/ViewTemplate . Then in the text box you would put

<$list filter="[all[current[tag[test]]">
Whatever text you want to be displayed when the tag is "test"
</$list>

Now it should display at the bottom of any tiddler tagged "test". If you click on the $:/tags/ViewTemplate tag, you can drag your tiddler up or down to position as you would like.

HTH

Joshua Poehls

unread,
Jan 6, 2021, 11:41:25 PM1/6/21
to tiddl...@googlegroups.com
Thanks for the reply. I feel like I’m probably missing something. I tried what I understood you say but it isn’t working like I expected. Here’s what I’ve got so far:



-- 
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/Jg-nmLk-yxs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/d637e6be-b5c9-4f75-928c-5d1730371a18n%40googlegroups.com.

maki aea

unread,
Jan 7, 2021, 12:49:07 AM1/7/21
to TiddlyWiki
i think you need to set your Test View Template content type to text/vnd.tiddlywiki


hth

Eric Shulman

unread,
Jan 7, 2021, 1:04:04 AM1/7/21
to TiddlyWiki
There is a syntax error in the filter:
   <$list filter="[all[current[tag[test]]">
should be:
   <$list filter="[all[current]tag[test]]">

(i.e., the third open bracket should be a CLOSE bracket)

-e

maki aea

unread,
Jan 7, 2021, 2:17:00 AM1/7/21
to TiddlyWiki

my bad, eric is right! (also my answer was wrong, sorry)

Joshua Poehls

unread,
Jan 7, 2021, 11:37:31 AM1/7/21
to tiddl...@googlegroups.com
This fixed it. 🤦‍♂️

Thank you all for the help!

Joshua Poehls

On Jan 7, 2021, at 12:04 AM, Eric Shulman <elsd...@gmail.com> wrote:

There is a syntax error in the filter:
--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/Jg-nmLk-yxs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

Javier Eduardo Rojas Romero

unread,
Jan 29, 2021, 1:31:36 PM1/29/21
to 'Mark S.' via TiddlyWiki
On Wed, Jan 06, 2021 at 08:17:50PM -0800, 'Mark S.' via TiddlyWiki wrote:
> Now it should display at the bottom of any tiddler tagged "test". If you
> click on the $:/tags/ViewTemplate tag, you can drag your tiddler up or down
> to position as you would like.

Holy cow! I didn't know one can reorder tiddlers like that.

Thanks!

Reply all
Reply to author
Forward
0 new messages