ViewTemplate: remove an element?

71 views
Skip to first unread message

Erwan

unread,
Mar 3, 2021, 12:27:33 PM3/3/21
to TiddlyWiki

Hi everybody,

I'm wondering if there is a simple way not to display some elements (such as the date and list of tags) when a particular tiddler is rendered? The only way I can think of is to modify the system tiddler, but it's not very convenient.

Use case: I print my TiddlyWiki CV to a pdf file. I have a single tiddler which contains the full content, but the header looks a bit odd in the pdf.

Thanks!

Cheers
Erwan



Eric Shulman

unread,
Mar 3, 2021, 1:02:09 PM3/3/21
to TiddlyWiki
Rather than removing the unwanted tiddler elements, you can *hide* them using CSS.  To learn the class names of the elements, you can display the tiddler in question and then right-click on the elements in question and select "Inspect" (note: the exact menu item text can be somewhat different depending upon your browser).

For your stated use-case, the elements are ".tc-subtitle" and ".tc-tags-wrapper".

Then, assuming the tiddler has a title of "TiddlyWiki CV", you can create a tiddler, e.g. "MyCustomStyles", tagged with $:/tags/Stylesheet, containing
[data-tiddler-title="TiddlyWiki CV"] .tc-subtitle,
[data-tiddler-title="TiddlyWiki CV"] .tc-tags-wrapper
   { display:none; }

That's it.

enjoy,
-e

Erwan

unread,
Mar 3, 2021, 2:22:32 PM3/3/21
to TiddlyWiki
This is perfect! Thank you very much Eric :)

Erwan
Reply all
Reply to author
Forward
0 new messages