Parameterised Transclusion [TW 5.3.0]: Write a Function to Return Nodes of a Tiddler

Terminology

Here nodes of a tiddler say parent refer to any tiddler

  • Tagged with parent
  • Has been linked from inside text field of parent
  • Has links from its text field to the `parent tiddler

Solution: Wikitext script

\function nodes(parent) [tag<parent>] [<parent>links[]] [<parent>backlinks[]]

!! Example i
<<list-links filter:"[function[nodes],[Test Parent]]">>

!! Example ii
<<list-links filter:"[function[nodes],[Core Variables]]" type:ol>>

To give a try

Remarks

  • Put your function in a tiddler tagged with $:/tags/Global to be in access from any tiddler
  • Add your customization like add different colors for different nodes

See more example of function in TW 5.3.0: Parameterised Transclusion [TW 5.3.0]: Why is Function Called Function?

Question:

  1. Add more node like subtiddler (their title has parent/title format), …
  2. Can you propose a simpler solution?
2 Likes

Making this would be more complex, but I’d love to see something that counts (as related “nodes” of <..currentTiddler>) any other tiddlers where the title of <..currentTiddler> is listed in any of their fields (or at least any non-system field), AND any other tiddlers whose titles are listed within any of <..currentTiddler>'s fields.

I find that I rarely use plain-old links within the text field anymore; most links (most relationships) have some structure, and fields are great for articulating that structure. :slight_smile:

1 Like