List and link all tiddlers that contain the current tiddlers' title in their text

Hello there,

I want to create a list of tiddlers that contain the current tiddler’s title in the text, e.g.:
“Reference Tiddler” should contain the list
in the list there should be links to the Tiddlers that contain “Reference Tiddler” in their text

So far I couldn’t find a solution for this and can’t do it on my own. I am new to TiddlyWiki and also don’t have experience with javascript. Nonetheless this could be a great tool for me and I hope that you can help me with that.

Best regards,
Deniz

Very doable! Keep in mind that searching for a string through all of the text field of all other tiddlers can bog down if your wiki gets big.

<<list-links filter:"[search<currentTiddler>]">>

in a tiddler with the tag
$:/tags/ViewTemplate

3 Likes

The following code, will find all backlinks if you used [[Reference Tiddler]] as a link in other tiddlers

<<list-links filter:"[<currentTiddler>backlinks[]]" class="multi-columns">>

If you create a style-tiddler eg: myStyles tagged: $:/tags/Stylesheet it will create 4 columns.

/* WikiText rules */

.multi-columns {
	display: block;
	column-count: 4;
	column-gap: 1em;
	-moz-column-count: 4;
	-moz-column-gap: 1em;
	-webkit-column-count: 4;
	-webkit-column-gap: 1em;
}

@media (max-width: {{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}}) {
	.multi-columns {
		column-count: 2;
	}
}

My impression is that OP is not talking about actual links — just finding the string that corresponds to currentTiddler’s title…

But indeed, making hard links is a better path, if you can do it that way!

Also remember the Freelinks plugin will generate a link to any tiddler title found in the text when you are viewing a tiddler.

2 Likes

Thanks for the quick responses!

Springers solution is working for me.
Will this search for a string if used often be an issue later on? Right now I am saving all files outside the wiki and link to them to keep it smaller. Or does that not change anything

I’m not sure what you mean by “files”. Image files are notorious for bogging down a TiddlyWiki project if they are actually stored as data within image tiddlers…

But this question about the performance of a <<list-links>> macro — one whose filter searches every other tiddler’s text field — should not be directly affected by this question of where your “files” are stored.

It does, however, matter just how much text is being searched.

Here’s a good test case: try visiting the TiddlyWiki recently shared by @Scott_Sauyet — a wiki that serves up the whole King James Bible — and make a tiddler called “Joses” with this content:

<<list-links filter:"[search<currentTiddler>]">>

The fact that Joses is only mentioned a handful of times doesn’t matter. This list-links macro still trawls through all 32 thousand tiddlers, looking for “Joses” in the text field. So it takes a couple seconds to render.

Looking for [<currentTiddler>backlinks[]] (tiddlers with links to the current tiddler) is faster, though, since links are more efficiently tracked.

See this reflection on using freelinks, together with a list-links macro view template, on a fairly large wiki:

1 Like

Keep in mind freelinks can be turned off when not in use, and a list links could be hidden behind a details widget, or in a tiddler that only generates the list on demand.

2 Likes