How to add a navigator to jump to prev and next Tiddlers?

Hi Folks,

I’m trying to use TiddlyWiki to compile teaching materials for my professor, a small textbook so to speak.

I want to add a navigation bar at the end of each (section) Tiddler to jump to the previous and next sections, like those commonly seen on blogs, or a simplified version of what Soren Bjornstad implemented on his GrokTiddlyWiki.

So far, I have:

  • One Tiddler for each chapter, tagged chapter.
  • Each chapter has a dozen of sections, each section has an individual Tiddler, tagged chapter1, chapter2, etc… And a user-defined field index, for ordering the content, valued 1a, 1b, …, 2a, 2b, and so on.
  • In chapter Tiddlers, I use {{{ [tag[chapter1]sort[index]] }}} to list out all the sections of this chapter.
  • A Tiddler named $:/tags/ViewTemplate, a template for the navigation bar. (but later may have to exclude it from the chapter Tiddlers)

However, I don’t know how to filter out the links of the previous and next Tiddler.

  • In the documentation, there are before Operator and after Operator, but they require a list field filled, (in my case, for each chapter Tiddler I have to provide a list of ordered sections).
  • I also thought about making use of the journal tag, then the content may have to be organized chronologically.

What is the best practice to realize this?
Thanks a lot!

I’m on mobile so it’s awkward right now, but if you can get a filtered list, the Before and After filter operators should do what you want.

{{{ [tag[Filter Operators]sort[title]before<currentTiddler>] }}}

—

{{{ [tag[Filter Operators]sort[title]after<currentTiddler>] }}}

Only the Previous and Next operators need the list field, the two above just need a list of input titles.

2 Likes

Welcome @lyjones. TW’s prolific plugin creator @Mohammad has already taken care of this usecase.

See his wiki, TW-Utility [source code].

It has a macro simple-navigation, which you can use to show navigation links “Next|Previous” under your tiddlers.

See

  1. demo/simple-navigation
  2. $:/plugins/kookma/utility/macros/simple-navigation
2 Likes

Thanks Brian, it’s clear enough!

In my specific case, I used the following two for previous/next Tiddler.

{{{[has[index]]+[sort[index]]+[before<currentTiddler>]}}}

{{{[has[index]]+[sort[index]]+[after<currentTiddler>]}}}

Thank you for your reply, it’s very helpful :slight_smile: