Tiddler appearance based in a tag

62 views
Skip to first unread message

Luis Gonzalez

unread,
Jul 17, 2019, 4:36:40 AM7/17/19
to TiddlyWiki
What can I do to change the appearance of the tiddlers depending on theirs tags?

If I add the "person" tag the tiddler body has to show the "Name" and "Telephone" fields. But If I add the tag "car" the fields that has to appear are "License plate" and "Kilometers".

Luis Gonzalez

unread,
Jul 17, 2019, 8:18:46 AM7/17/19
to TiddlyWiki
I know how to change the basic appearance ot tiddlers tagged "person": colors, font size etc. You have to add in a tiddler with the "$:/tags/Stylesheet" tag something like this:

.tc-tagged-person {
    background-color: #fff5e6;
    border: 0.4px solid brown;
}

This change the colors of all tiddlers tagged with "person".


I know the basic starting of Tiddlywiki:
1. The browser opens the wiki.html file
2. It starts the javascript code.
3. It prepares all basic tiddlers.
4. This basic code and tiddlers draw the wiki content based in the $:/core/ui/PageTemplate tiddler.
5. This page template tiddler has all open tiddlers in the list field of the tiddler $:/StoryList
6. At the end, all this tiddlers are drawn based in the tiddler template: $:/core/ui/ViewTemplate

I tried to change the ViewTemplate without any success.

¿Does anybody know how to draw different fields depending on the tag of the tiddler?

Thanks!!

Jed Carty

unread,
Jul 17, 2019, 8:26:05 AM7/17/19
to TiddlyWiki
Here are the steps in detail:

- Make a tiddler
- give the tiddler the tag $:/tags/ViewTemplate
- Put this in the text field

<$list filter='[<currentTiddler>tag[HelloThere]]'>
HI!
</$list>

- Change HelloThere to what every tag you want to use
- Change HI! to whatever content you want, presumably <$tranclude field='name'/> or <$view field='name'/> given your question
- If you want to put this anywhere but at the bottom of tiddlers add a field called list-after
- In the list after field put the template that you want this listed after, to list it directly after the title use $:/core/ui/ViewTemplate/title
- To see a list of all of the templates go to the advanced search and search shadows for $:/core/ui/ViewTemplate

If you want to change the appearance when editing than you change ViewTemplate to EditTemplate everywhere in the above example


Luis Gonzalez

unread,
Jul 17, 2019, 8:42:48 AM7/17/19
to TiddlyWiki
Awesome!!. it works perfectly


Its precisely what I wanted.

I'm starting personalizing tiddlywiki and I do not know many things.


Thanks!!


Reply all
Reply to author
Forward
0 new messages