How to create hard link using macro?

182 views
Skip to first unread message

Tejasvi S Tomar

unread,
Sep 10, 2020, 7:22:54 AM9/10/20
to TiddlyWiki
My goal is to add backlinks for transclusions. I have created a macro \define link_and_transclude(tiddler) [[|$tiddler$]]{{$tiddler$}}. It, however, doesn't trigger backlink generation, which is consistent with the docs for hard and soft links.

Setup:
Node.js, v5.1.22
Distro: Drift
Public sample: https://mefyi.com/neuron

talha131

unread,
Sep 10, 2020, 12:45:32 PM9/10/20
to TiddlyWiki

I think your macro needs following snippet of code to show the backlinks correctly

<$list filter="[<currentTiddler>backlinks[]]">
<$view field="title"/> <br />
</$list>

talha131

unread,
Sep 10, 2020, 12:47:51 PM9/10/20
to TiddlyWiki

Another approach

<<list-links [<currentTiddler>backlinks[]]>>

Tejasvi S Tomar

unread,
Sep 10, 2020, 1:49:37 PM9/10/20
to TiddlyWiki
@talha, Thanks for the response. But I think I could've phrased my query better.

Context:
End goal:
  • Ability to generate backlinks for transclusion.
    • Ways to achieve:
      • Create an empty text link ( using [[|Tiddler]]) every time while transcluding.
        • Repetitive, undesirable.
      • Create a macro that generates the link and transcludes the tiddler.
        • \define link_and_transclue(tiddler) [[|$tiddler$]] {{tiddler}}
        • Not possible because the generated link is a soft link; backlinks not detected.
      • Modify the backlink generation mechanism to consider the transclusion syntax.
        • I don't have sufficient knowledge. Seems complicated on the first look of backlinks-indexer.js.
      • Create a new transclusion-backlink mechanism analogous to the existing backlink mechanism
        • As mentioned earlier, the lack of expertise.
      • Use freelinks
        • Not preferred due to ambiguity with "mentions".
Example:

tiddlerA = Some text
tiddlerB = {{tiddlerA}}

Goal: List tiddlerB among the tiddlerA's backlinks

talha131

unread,
Sep 10, 2020, 2:02:22 PM9/10/20
to TiddlyWiki

I see. I posted a similar question few days ago. The conclusion was to look up the code of ReLink plugin. I ended up using tag hierarchy instead of creating backlinks from macro.

talha131

unread,
Sep 14, 2020, 10:38:59 AM9/14/20
to TiddlyWiki
Tejasvi, did you find a solution to the issue?

I also need a way to get soft links to a tiddler.

Tejasvi

unread,
Sep 17, 2020, 7:08:10 AM9/17/20
to TiddlyWiki
Unfortunately, I haven't. Also, I don't think backlinking using soft links would be possible without hacking the TW core. See Jeremy's comments on this and this. Specifically for transclusions, another possible way could be to create an editor macro activated by shortcut (similar to excise), which "expands" the transclusion syntax with an additional direct link. In the end, I gave up trying to bend it to my will due to the tradeoff of benefit and time (the only thing that isn't unlimited).

TW Tones

unread,
Sep 17, 2020, 8:20:06 PM9/17/20
to TiddlyWiki
Tejasvi,

Don't give up. There are various ways we cross reference tiddlers, back-links are but one. I started looking into this but do not have time to complete, but it is a simple matter of searching for a tiddler name wrapped in curly braces. 

Of course such a search needs to be global, so could add a delay in large wikis, I imagine an expandable part of the view template, 
which if you click shows tiddlers that transclude the current one, and list tiddlers transcluded in the current one. Or perhaps a new tab behind the info button?

Regards
Tony
Reply all
Reply to author
Forward
0 new messages