Links from Fields and Backlinks

Part 1
I have a Tiddler (TiddlerA) where a field “property” contains the name of another Tiddler (TiddlerB).

I want to display the name of TiddlerB as a link in TiddlerA.

This displays TiddlerB as text, but I want a link. What is the correct syntax?

{{!!property}}

Part 2

Can I also use fields for backlinks?

So, in TiddlerB display as a link TiddlerA, but the only reference to TiddlerB occurs in the property field of TiddlerA.

<$link to={{!!property}} /> - see LinkWidget

The other Q is a bit more complex (but not very difficult) and I’m too tired right now so will pass it on to someone else. But I’d think you’d make a viewtemplate that searches the propertyfields of all other tids to match it with the title of the current tiddler.

@twMat Thank you, perfect.

They do not do this out of the box, but keep in mind backlinks are but one way of interlinking tiddlers. There are other such as behind the Info button. You can create a tiddler with the tag $:/tags/ViewTemplate that searches for the currentTiddler title in all fields in all tiddlers to find where it is also mentioned in fields. See https://tiddlywiki.com/#search%20Operator%20(Examples)

I cannot see how to do this even with the help of the examples page. Could you give an explicit example, please.

This doesn’t work, but it should give a clue to what I am trying to do.

<$list filter="[property[<<currentTiddler>> field=title/]]">
<$link/><br>
</$list>

I want it to show a link to TiddlerA if TiddlerB appears in the property field of Tiddler A.

Hardcoding like this does work:

<$list filter="[property[TiddlerB]]">
<$link/><br>
</$list>

So it seems my problem is trying to grab the title of the current tiddler.

title: backlinks
tags: $:/tags/ViewTemplate
list-after:
text:
<$list filter='[all[tiddlers]property<currentTiddler>]'>

</$list>

The title can be anything.
The tag makes it into a viewtemplate that appears in all tiddlers (altho nothing to show for most)
list-after ensures it is shown at bottom of tiddler.
The code is probably self explanatory.

2 Likes

Is available above from twMat.

Thank you.

What is still puzzling me is what these lines are doing:

title: backlinks
tags: $:/tags/ViewTemplate
list-after:

text:

I tried pasting the whole block into a Tiddler and it did not produce any output, but if I just paste

<$list filter='[all[tiddlers]property<currentTiddler>]'>

</$list>

It works as expected. Then I tried it without the blank line before </list> and it does not work, which seems a bit strange as often a blank row in the block of code can cause code to fail. So, what is the logic/syntax that is going on here?

Thanks.

If the list widget is empty with one blank line it defaults to a simple template. Otherwise you may put <$link/><br> inside to get the same result.

If you set a list-after or list-before field it changes the order within which the tagged tiddlers are listed. If empty it will go towards the top or bottom of the list.

In the top example of yours this is indicating the content of fields title tags etc. You set them to the value after :

You ask about the initial three lines, i.e

This is why I explained these in my previous post.

In general, tiddlyWiki and “code discussions” use a syntax like so

fieldname: value

so, for example

title: Foo

simply means that the field title in a tiddler has the value Foo.

You can see this is if you export a tiddler (tiddler tool more > Export tiddler > .tid format) and read the resulting file in a text editor.

If you have created a custom field, like your ´properties´ field, then this will appear just as any other field in that exported tiddler.

Right, the blank line in the otherwise empty listwidget content is a convenience to show the resulting output with a newline. It is equivalent to inserting <$link/><br> there.

If you want the output without the linebreaks, then you can omit the empty row but you must really omit it, i.e no other string must be there.

If you do still insert a string, e.x X then this string will show in place of the output result. If the string is a space character, i.e <$list filter="..."> </$list> (note the space between the two tags) then the output of multiple space characters is not very visible, just like if you type in multiple space chars in the text of a tiddler.

You are evidently not quite familiar with the syntax so I’d suggest reading up on this via the various introductory sources you can find on tiddlywiki.com . This should give a more structured explanation of things which probably is better than a fragmented one from people replying to details like in this thread, but you’re of course always welcome to ask more here if things are unclear.

1 Like

Thank you, yes I’m learning by “hacking”!