Alternate page template which moves clicked tiddlers to the top of the story

Sure, here it is embedded in a share-site url: move-to-top pagetemplate on the share site. You can try it out there.

As mentioned in the other thread, this is the main piece of code involved:

<$linkcatcher message="tm-navigate" actions="""
<$action-listops $tiddler="$:/StoryList" $subfilter="[<navigateTo>] +[putfirst[]limit[15]]"/>
""">
1 Like

Some thoughts;

  • Perhaps make the limit settable?
    • The others are simply removed from the storylist? but still exist in the history, which suggests one may want to have a history list for use with this method.
  • Perhaps I just provide an additional layout in my focus-tiddler package to use this behaviour?

It raises the question if we could make message and link catcher hackable in the page template without having to use a layout?

  • Someone may want to use another layout and either of our solutions at the same time.
  • When I have attempted similar things in the past the problem is closing the widgets.

Yes and some people might not want a limit at all. I just know that I open tiddler more often than I close them so for me enforcing some limit is better.

Yes only the first 15 are kept and the rest removed. I’ve never paid much attention to $:/HistoryList until now. Looks like it constantly grows, even keeping duplicates. My listops action does not maintain duplicates and as mentioned the size is capped. In addition, closing tiddlers removes them from the storylist, but not the history list.

I’m not sure what it would mean to “have a history list for use with this method”.

I saw your code uses a tag ([tag[$:/tags/on-focus-actions]]) to include extra actions to execute when navigation is triggered (though maybe that is a work-in-progress? When I switched to the layout, I couldn’t get the focused element in the Elements tab to change). Using tags for such actions seems as good of a way as any. You could include my $action-listops that way.

Exactly. The need to wrap some part of the wikitext with both the open and close tag of the linkcatcher widget (or in your case the action-sendmessage widget) makes it more difficult to use tags+transclusion to make it more easily “hackable”.

Oh, this is fantastic! I can easily see using this for my documentation project. It seem so much more intuitive than the default version.

Thank you for sharing.

One possibility I could see related to your conversation with TWTones, is to use the history list to in some way track those tiddlers which have fallen off the end because of the 15-limit, and if room opens back up to re-add them. I’m not sure I’d bother, but it might be an interesting behavior.

I will share one tomorrow, that also hides those open in the story river;

Only grows in the current session, save an reloading the wiki clears it.

  • But the method you saw “uses a tag to include extra actions to execute when navigation is triggered” is the way, and common in the core.

To change the “elements” in the tab without the link catcher active just click the target icon for focus. Without the link catcher and using links the current tiddler focus changes but does not execute actions. The link catcher is all about not only change in the focus but triggering other actions, such as handling elements.

  • Its quite usable without the link catcher disabled, if you know this, because you must click a tiddlers target icon to get it recognised, as more deeply focused on.

Tested this morning, and it’s perfect for my documentation wiki. Thank you very much for sharing this!

Feast your eyes on this brilliant code from @Yaisog in a comment at github: [IDEA] Should tm-close-tiddler (optionally) navigate to the previous tiddler? · Issue #7262 · Jermolene/TiddlyWiki5 · GitHub. I haven’t tried it yet, but it uses the $genesis widget to very neatly solve the above problem.

1 Like

I’ve been using this regularly since you published it. I finally traced down an error that occurs in some of my wikis to this layout, and the fix is simple.

It doesn’t recognize $:/tags/Global, only $:/tags/Macro. I kept working around this problem, without understanding its cause, by changing the tag on that tag to Macro. Today, I decided that I needed MoveToTop on my current wiki, and all my top-level content immediately disappeared. That made it obvious that this was the culprit. And now that I have more experience with TW, I could see why.

To fix this, just add the following to the import pragma:

[all[shadows+tiddlers]tag[$:/tags/Global]!has[draft.of]]

Thanks for a great tool!

1 Like

Thanks for pointing that out. I still use this page template and I hadn’t noticed.

The current version of the default page template actually uses this:

\import [subfilter{$:/core/config/GlobalImportFilter}]

And there are a few other changes in the default template since I wrote my alternate template. I have incorporated these changes in this new share-site url: move-to-top pagetemplate on the share site