Backlinks in fields

Hi all

if I create a list filter to grab backlinks to the current tiddler, it only displays backlinks from the text fields of the other tiddlers.

Is there a way to grab backlinks to current from ‘any’ field of the other tiddlers? That way I could keep the text field clean of extra stuff, and have links to sources in a source field, links to topics in a topic field, etc.

I would equally accept an explanation on how to write a filter that specifies a specific field, as in “all tiddlers regexping to current tiddler in their “muffin” field” or, better, “all tiddlers backlinking to current tiddler in their “muffin” field”

If I understand you correctly, then this seems to work in my testing:

{{{ [all[tiddlers]has[muffin]]:map[enlist{!!muffin}match<..currentTiddler>then<currentTiddler>]}}}

This also seems to achieve the stated goal:
{{{ [all[tiddlers]contains:muffin<currentTiddler>] }}}

1 Like

Thanks Mark and Eric!

I will just add you can also use the search:* operator to find the title as a string in any field in any tiddler and then you could have another filter to handle identifying which field(s) contains the title.

eg;

<$list filter="[all[shadows+tiddlers]search:*:literal<currentTiddler>] -[[$:/StoryList]] -[[$:/HistoryList]] -[<currentTiddler>]">

</$list>

But you could also exclude from the result those already a backlink or reference etc…

Eric, is there a way to use a variable as the fieldname in the above?
{{{ [all[tiddlers]contains:<fieldname><currentTiddler>] }}}
is not working.

Bumping this topic as I’m not sure if Dave’s question was fully answered, but I have a similar problem. My usage is I am keeping track of all the live music shows I attend. Here is an example show-20211228.json (421 Bytes)

I have the venue stored in the location field and when I open [[The Royal Room]] tiddler, I would like to show a list of all of the shows at The Royal Room.

Hi @markkerrigan, Eric’s solution should do the trick:

All you have to do is make it appear on every tiddler. So create a tiddler with whatever name you want, and add the following text:

{{{ [contains:location<currentTiddler>] }}}

Then to tell TiddlyWiki to display this template on every tiddler in your wiki give it the special tag $:/tags/ViewTemplate.

One thing to bare in mind is that exactly how you store the name of the venue will affect which filter you should use. If you use square brackets ([[The Royal Room]]), then contains will recognise this is a single tiddler in a list. However if you don’t use the brackets (The Royal Room), then contains will view this as a list of three tiddlers (The, Royal and Room), so won’t give you a match. If you don’t want to use square brackets, you can use the field operator instead:

{{{ [field:location<currentTiddler>] }}}

@Sii thanks for the quick reply.

Is there a way to specify the caption instead of the tiddler title when doing a filtered transclusion with triple curly brackets?

Yep, you can use a text reference as a filter parameter by enclosing it in single curly brackets:

{{{ [contains:location{!!caption}] }}}

1 Like

Hmm, I should have been a bit more specific, as I wanted the list to display the caption of the filtered tiddlers instead of using the caption as part of the input filter.

{{{ [contains:location<currentTiddler>get[caption]] }}}

Is there a way to format the output so the results are valid links to the tiddlers? Right now it just returns the caption, but not a valid link to the tiddler.

Ronan Delisle / Amelia Coulter

Yes, but at this point I would use the list widget instead of a filtered transclusion:


<$list filter="[contains:location<currentTiddler>]" >
  <$link to=<<currentTiddler>>> {{!!caption}} </$link>
  <br>
</$list>

Yes I know the it would better to use the list widget, but is it even possible to do such a thing with a filtered transclusion?

Oh OK - I can’t think of any way to do it entirely within a filter expression, but I don’t know that it’s impossible.

Not really, but you can make a macro, that contains the list widget as @Sii suggested. So it would be easier to call.