Search code examples
tiddlywikitiddlywiki5

Trouble auto-generating list of links


I have a page in my Wiki (v5.1.17) that is supposed to auto-generate a list of links to tiddlers that need some sort of follow up. What shows up is whatever fulfils one of two criteria: tagged "needs_followup", or title begins with "/followup/".

Here is my code:

<$list filter="[prefix[/followup/]] [tag[followup_needed]] +[sort[title]]" variable=entry> <$link><<entry>></$link><br/> </$list>

The list of items works fine actually, except that they're not clickable links. They look like links -- blue and underlined -- but clicking on one doesn't actually do anything. Can anyone please tell me what I'm doing wrong?


Solution

  • The list of items works fine actually, except that they're not clickable links.

    The problem arises because you have changed the variable in which the list widget stores titles. Usually the list widget stores the current title in a variable named <<currentTiddler>>:

    This variable name is well known by other widgets, e.g. the link widget will look for this variable when no to attribute is specified.

    However, your list widget instance stores the current title in a variable named entry, which is not understood by the <$link> widget.

    They look like links -- blue and underlined -- but clicking on one doesn't actually do anything.

    Actually, they are "real" links and also navigate once clicked: The link widget will resolve the tiddler where your code is in as <<currentTiddler>> and try to link to this tiddler (which looks like it is not linking at all because you probably have no scroll effect).

    Can anyone please tell me what I'm doing wrong?

    Solution 1) Hence the solution is to add the to-attribute and set it to <<entry>>:

    <$list filter="[prefix[/followup/]] [tag[followup_needed]] +[sort[title]]" variable=entry>
        <$link to=<<entry>>><<entry>></$link><br/>
    </$list>
    

    Solution 2) Instead of setting to you could also do the following:

    <$list filter="[prefix[/followup/]] [tag[followup_needed]] +[sort[title]]" variable=entry>
        <$set name="currentTiddler" value=<<entry>>>
            <$link><<entry>></$link><br/>
        </$set>
    </$list>
    

    Solution 3) Or you could remove the variable=entry altogether

    <$list filter="[prefix[/followup/]] [tag[followup_needed]] +[sort[title]]">
      <$link><<currentTiddler>></$link><br/>
    </$list>
    

    Offtopic: you may also want to use the $view widget to render the title to avoid auto wikification of PascalCase titles as links: <$link to=<<entry>>><$view field="title" /></$link>