How do I hide an Item from the table of contents while keeping the tag?

I have a table of contents set up on the sidebar and it works fine.

I am using the ttrpg plugin and it generates templates for elements in my game.

My problem is that I want the templates to be generated by default inside other tiddlers, so I am using tags in the templates, but the template is listed as well as the elements themselves under each category.

How do I keep a tag on a tiddler but stop it from showing in the table of contents under that tag category?

Here’s the page for y’all: https://gabes-campaign-template.tiddlyhost.com/

Hi, You can use the “exclude” parameter with a filter, that identifies your templates. eg: You could add a field: toc-hide: yes to your templates.

Then as an additional toc-parameter you can use exclude:"[toc-hide[yes]]"

<div class="tc-table-of-contents">
<<toc tag:"Contents" exclude:"[toc-hide[yes]]">>
</div>

Also see. https://tiddlywiki.com/#Table-of-Contents%20Macros

have fun!
mario

1 Like

Much appreciated! Let me implement that!

Another question, I would like to get rid of the portrait block and the “description” box on my templates and I can’t seem to be able to do it without nulifying the template blocks. I can’t find what is the bit of the plugin that I have to edit. Any ideas?

Alright, so it didn’t work as expected.

I have tried multiple formats and I must be missing something.

Here’s what I have, where "Elements’ is how I call my TOC.

<div class="tc-table-of-contents">

<<toc-selective-expandable 'Elements'>>

</div>

I have tried this first:

<div class="tc-table-of-contents">

<<toc-selective-expandable 'Elements' toc tag:"Contents" exclude:"[toc-hide[yes]]">>

</div>

And I added the field “toc-hide: yes” to the Tiddler I wanted to hide.

What it did was hide every other subtiddler.

Then I realized the Tag must be wrong, so I changed it to

<div class="tc-table-of-contents">

<<toc-selective-expandable 'Elements' toc tag:"02 Cast" exclude:"[toc-hide[yes]]">>

</div>

Still no success. I did read the page on macros but I continue lost. What am I missing?

If I take your invocation of toc-selective-expandable and look here Table-of-Contents Macros then compare this with your parameters I see you may not be doing this correctly;

  • 'Elements' toc tag:"02 Cast" exclude:"[toc-hide[yes]]"
    • The first parametyer has no name so it becomes the first parameter and maps to the tag parameter. This will be the top of you TOC, what is elements?
    • The second unnamed parameter qwill be assigned to the sort parameter but it is the incorrect format, should be sort[title] or similar, what is toc?
    • the third parameter is namesd as tag:"02 Cast" but you already provided the tag as elements.
    • The fourth parmater is named and has the correct type of value value exclude:"[toc-hide[yes]]" which looks correct.

The absolutue safest way is you are having issues with parameterts is to name everyone of them when you call the macro so it does not matter what order you provide the values. When you do that share it back here.

1 Like

Thank you!

Hang on, let me try!

I have come to this

<div class="tc-table-of-contents">

<<toc-selective-expandable tag:"Elements" exclude:"[toc-hide[yes]]">>

</div>

I have 3 different outcomes and I don’t think either is correct.

  • This hides the undesired tiddler but I don’t have expandable lists anywhere:
<div class="tc-table-of-contents">

<<toc "Elements" exclude:"[toc-hide[yes]]">>

</div>
  • This hides the undesired tiddler but I don’t have an expandable list specifically under the tiddler where the undesired tiddler is:
<div class="tc-table-of-contents">

<<toc-selective-expandable "Elements" exclude:"[toc-hide[yes]]">>

</div>
  • this gives me an error:

Filter error: Missing [ in filter expression

<div class="tc-table-of-contents">

<<toc-selective-expandable tag:"Elements" exclude"[toc-hide[yes]]">>

</div>
  • And this
<div class="tc-table-of-contents">

<<toc-selective-expandable tag:"Elements">>

</div>

seems to be identical to this in outcome:

<div class="tc-table-of-contents">

<<toc-selective-expandable "Elements">>

</div>

I simply don’t know what I am doing wrong.

:face_with_monocle: I’m not sure whether to suspect there’s an invisible typo — but pasting into your site I get a perfectly respectable-looking result with

<<toc-selective-expandable "Elements" exclude:"[toc-hide[yes]]">>

The error comes from the block below, not above, sorry :smiley:

Anyways, no it did not work for me:

I applied field toc-hide with value yes to tiddler session 99 and as you can see, the Sessions category broke.

EDIT:

If I delete the field from Session 99, it appears under Sessions but the expandable button is still broken.

  • here you use a different macro, “toc” this is not expandable by design.

The identical behaviour is because the only difference is you did not name the first partameter in the second.

The following works on TiddlyWiki.com

<div class="tc-table-of-contents">

<<toc-selective-expandable tag:"TableOfContents" exclude:"[toc-hide[yes]]">>

</div>
  • I edited “editions” to have toc-hide=yes and it is not listed
  • I also edited audio toc-hide=yes and it too is not listed under features

No dice for me. I did add the field correctly too, right?

This time I even renamed my TOC tiddler to “TableOfContents” to rule everything I could out.

image

I’m not following what the “it” is (what exactly is not working?).

It seems to me that the 07 Sessions heading in your expandable toc isn’t “broken” — it just displays without a caret when there’s nothing there to show via expansion, which was the result of excluding the one tiddler that carried that tag (as far as I can tell from here).

EDIT: Ah, reading your post again (with your later edit)… it’s possible that the expansion caret visibility did not update promptly for some reason; it’s hard for me to troubleshoot. At any rate, when I load your site, it all seems to behave ok now.

(A good troubleshooting strategy is to try a version of what you’re attempting (something analagous, based on the content available there) over at tiddlywiki.com… If it works there, backtrack (make things more simple) until you figure out what’s causing the difference.)

I can verify that the same error (?) is happening on tiddlywiki.com. Here’s what I tried:

I used Tony’s code—which does work, on its own:

  • I then used a button to add the field toc-hide: yes to all the existing tiddlers tagged HelloThere.
  • I created a new tiddler, “Testing HelloThere”, also tagged HelloThere, which you can see in the standard table of contents in the sidebar. However, you can see that it doesn’t appear under “HelloThere” in my test TOC, and there’s no option to expand the section (because it doesn’t recognize that a new tiddler has been added?)

This happens in both the preview and in view mode when I save my test tiddler. Adding additional tiddlers with the HelloThere tag doesn’t fix the broken TOC.

EDIT:
I was also curious if it was a refresh issue, so I saved a copy of the tests I’d done on tiddlywiki.com. The issue persists when I open the wiki as a local file.

  • Editing the test tiddler doesn’t fix it either.

A fix, but not an answer:

  • Removing exclude:"[toc-hide[yes]]" from the macro and re-adding it forces it to update, after which it seems to work correctly.

Fascinating. I do now follow what the problem is that @ TheGiftOfGabes was describing.

As you confirm, the expansion caret is missing after adding back in ONE child tiddler without the toc-hide:yes field value. But when I added back in a second child tiddler, it displayed properly again.

Whatever’s going on is glitchy for sure!

1 Like

That’s interesting! I did try adding a second child tiddler, and it didn’t fix the issue for me (though as I noted in my edit above, editing the macro itself did.)

Further testing: if I have the section expanded before I hide existing children and add new ones, the branch remains “open,” so I’m able to see the new tiddlers, but not the caret.

If it’s any consolation, @TheGiftOfGabes, I don’t think you’re doing anything wrong!

Re: your template issue, I admit I’m finding your wiki edition somewhat nonintuitive, but if you could clarify (ideally with some live examples) what the current behavior is and what you’d like it to look like, I’d be happy to dig around in the plugin templates for you.

2 Likes

I think there is a bug in the toc-selcetive-expandable macro. If the first element of a branch has toc-hide:yes the chevron is not shown, even if there are other elements.

I’ll have to have a closer look

1 Like

@TheGiftOfGabes – There is two more things.

  1. Your tag-tiddlers should not be tagged with itself. So: 01 Setting shoud not be tagged: “01 Setting”
    Technically this can cause an endless loop. It’s works since the toc-macros do have some “protection” code against endless loops.

  2. Your ViewTemplate. Is there a reason, why you show the tiddler fields and the tag-picker in view-mode for every tiddler?
    It should be possible to only show those fields, for those tiddlers, that really need them.

Just some thoughts

1 Like

Ah, this explains why adding a second non-hiding child happened to work for me, but not for @etardiff — it just happened that the additional one I added was alphabetically prioritized.

Reordering the children within the relevant tag pill instantly has the effect of making the caret display (if first tag-child is not hidden) or not display (if first tag-child has the toc-hide field set to yes).

2 Likes

Thanks for looking at it! I’ll make a new post later to keep this focused, is it ok if I tag you there?

Folks, so it seems I can’t do it and it’s not my fault :smiley:

Anyways, thank you all for spending time on this and trying, I appreciate it :slight_smile: