How to hide the tiddler body if a particular viewtemplate is applied on that tiddler. Is there is easier way other than adding hide-body
field to each of those tiddlers manually.
Can this be modified for my usecase
https://groups.google.com/g/tiddlywiki/c/3HtWuEOSPwo/m/pMIN4h8CAgAJ
I don’t want add any extra tags or fields to those tiddlers
If these two are not possible, can I hide the tiddler body using another viewtemplate
Can you give some examples of usage of cascade in any of you plug ins? Then I can search those tiddlers to see how it’s is used
If you want the body of tiddlers to be rendered differently as in this case hide the body, which is the rendering of the text field, you first need to determine under what conditions your want it to occur.
A standard view template ie tagged $:/tags/ViewTemplate can’t handle this as this tends to add things to the view template.
See the ControlPanel > Info > Advanced > Cascades > View Template Body
See item 4. $:/config/ViewTemplateBodyFilters/hide-body
[field:hide-body[yes]then[$:/core/ui/ViewTemplate/body/blank]]
You could clone this tiddler (or modify it) to provide an additional condition your condition
, resulting in the use of $:/core/ui/ViewTemplate/body/blank.
- Check the $:/tags/ViewTemplateBodyFilter tag is on your tiddler and it is in the correct order eg; list-before
$:/config/ViewTemplateBodyFilters/default
However I have to ask why would you want to simply hide the body? You could have a more sophisticated template.
This is the reason for the need to hide tiddler body. I was looking for a way to hide the tiddler body other than manually adding the hide-body
field to each tiddler
So using the method I proposed determine an alternative condition to field:hide-body[yes]
and return your own custom body tiddler
[yourcondition]then[yourbodytemplate]
Then in yourbodytemplate you decide what to show, perhaps the text field in a left column and charts in the right column. There is no need to hide the body because your are replacing the body, for tiddlers with yourcondition.
I notice in the first post you filter has syntax errors,
-
You uised
[all[current]![system]![shadow]!tag[$:/tags/SideBar]!TheBrain[no]!tag[Journal]]
-
Perhaps you mean
[all[current]!is[system]!is[shadow]!tag[$:/tags/SideBar]!TheBrain[no]!tag[Journal]]
-
and it also “rules out” tiddlers with the balance showing the echarts. It would be better to have a condition to “rule in” what about
[all[current]TheBrain[yes]]
? -
The echarts process needs some information to display its results, perhaps use one or more of this information to trigger an echart display.
Once working, perhaps the code in your original post, will be placed in your tiddler “yourbodytemplate” and all will be working.
Thanks you. I am not that used to writing filters. That was a mistake which i didn’t realize until you pointed out.
For creating an alternative condition also, I have to manually add some fields or tags to each tiddler rite. Is there something which I am missing. It would have been nice if there is an option to hide one viewtemplate when another viewtemplate is used on a tiddler.
For the time being I removed the $:/tags/ViewTemplate
tag from the $:/core/ui/ViewTemplate/body
.
Then created another tiddler with this as content
<$reveal tag="div" class="tc-tiddler-body" type="nomatch" stateTitle=<<folded-state>> text="hide" retain="yes" animate="yes">
<$transclude tiddler={{{ [<currentTiddler>]
:cascade[all[shadows+tiddlers]tag[$:/tags/ViewTemplateBodyFilter]!is[draft]get[text]]
:and[!is[blank]else[$:/core/ui/ViewTemplate/body/blank]] }}} />
</$reveal>
and tagged it with $:/tags/ViewTemplate
.
This is working in my short test. Is there anything wrong with this approach.
This one doesn’t mean anything I think
Your above approachs are not following the way I suggested also i am not sure what they are doing to solve your problem. They do involve you altering the core view template which we try to avoid.
Please revisit and answer the question under what conditions do you want special treatment of tiddlers to display your additional content?
If you do not have any conditions in mind to you want every tiddler to display the text with your extra column?
Once a custom body is available for your alternate view of tiddlers what code do you have already for this?
I also don’t want to use that approach if there is an alternative
I want that custom viewtemplate to be applied to almost all other tiddler I create except for the system, shadow tiddlers, journal tiddlers, those tiddlers with stylesheet and viewtemplate tags.
See this for the custom viewtemplate I am using.
It’s ok if there is no alternate approach, since this plug in may solve the problem, although it’s still to be created
I can prepare an implmentation based on the info I now have, tomorrow.