How to make a Navigator using Fields?

Hello @EricShulman,
I tried to display also the tags of the tiddler in the navigation with <$transclude $variable=tag-pill tag={{!!tags}}/> - but I failed. It shows the tags of the current tiddler:

<div class="next"><% if [<next>!match[]] %>
    	<$link to=<<next>> > <<next>><span style="font-size: 80%; color: rgb(144, 238, 144);">&emsp;<$view tiddler=<<next>> field="published" format="date" template="DD. MMM YYYY"/></span>
		<span style="font-size: 65%; color: rgba(204, 204, 255, 0.45); margin: 0 0.5em">aus Gruppe:</span>
		<span style="font-size: 65%; opacity: 0.9;"><$transclude $variable=tag-pill tag={{!!tags}}/></span>
		<span class="arrow">{{$:/images/arrow-right-pointer}}</span></$link> 
  		<% endif %>
	</div>
</nav>

grafik


Addidtional by switching to prev / next I’d like to close the current tiddler.
How can that be achieved?

Thanks, Stefan

Try this:

<div class="next"><% if [<next>!match[]] %>
	<$button class=tc-btn-invisible to=<<next>>>
		<$action-sendmessage $message="tm-close-tiddler" $param=<<currentTiddler>>/>
		<<next>>
		<span style="font-size: 80%; color: rgb(144, 238, 144);">
			&emsp;<$view tiddler=<<next>> field="published" format="date" template="DD. MMM YYYY"/>
		</span>
		<span style="font-size: 65%; color: rgba(204, 204, 255, 0.45); margin: 0 0.5em">aus Gruppe:</span>
		<span style="font-size: 65%; opacity: 0.9;">
			<$tiddler tiddler=<<next>>><$transclude $variable=tag-pill tag={{!!tags}}/></$tiddler>
		</span>
		<span class="arrow">{{$:/images/arrow-right-pointer}}</span>
		</$button> 
  		<% endif %>
	</div>
</nav>

Notes:

  • Instead of using a $link widget, use a $button widget. This performs the same to=<<next>> navigation, but also permits the click to trigger a “side-effect” $action-sendmessage to close the current tiddler.
  • In the tag-pill macro, you use {{!!tags}} which gets the tags field value from the current tiddler. To show a tag from the <<next>> tiddler, you can enclose the macro call within a <$tiddler tiddler=<<next>>> widget.

-e

1 Like

Thanks @EricShulman for your quick response.
It works perfect as requested :+1:t3: - very nice!

Hi guys,

Sorry to return to this topic, but i identified a problem with my solution.

First: The sequence field jump from 1 to 10, or 2 to 20, so i need to write this like 0001, 0002, 0003 etc.
Second, if i need to made a entry in the middle of a chapter for some reason, i need to change all numbers and this become a problem, because i have more than 2400 tiddles.

So i think i need to made this using tags instead fields, but how to made it to obey the list field?

Just to share, i finally found a solution and now have inner peace :grinning:

I see this post Navigating complex tiddler relationships, a discussion for the enthusiast

And found a solution posted by @EricShulman and made some little tweaks to look how i needed

\define toc-root()  Livro do Mestre
\define toc-depth() 3

\define toc-nav()
\define tv-wikilinks() no
<$list filter="[enlist<all>before<currentTiddler>]">
   <$button class="tc-btn-invisible" style="float:left;text-align: left; color:#6e8be0;padding-top: 10px; width: 50%;" to=<<currentTiddler>>>
      {{$:/core/images/chevron-left}} <<toc-caption>>
   </$button>
</$list>
<$list filter="[enlist<all>after<currentTiddler>]">
   <$button class="tc-btn-invisible" style="float:right;text-align: right;color:#6e8be0; padding-top: 10px; width: 50%;" to=<<currentTiddler>>>
      <<toc-caption>> {{$:/core/images/chevron-right}}
   </$button>
</$list>
<div style="clear:both;"/>
\end

\define toc-list(here,max,exclude,level:"1")
<$list filter="""[tag[$here$]] $exclude$ -[[$here$]]""">
   <$text text="[["/><<currentTiddler>><$text text="]]"/><br>
   <$reveal default="$level$" type="nomatch" text="$max$">
      <$macrocall $name="toc-list" here=<<currentTiddler>> max="$max$"
         exclude="""$exclude$ -[[$here$]]""" level={{{ [[$level$]add[1]] }}}/>
   </$reveal>
</$list>
\end

<$wikify name="all"
   text="""<$macrocall $name="toc-list" here=<<toc-root>> max=<<toc-depth>>/>""">
<<toc-nav>>
</$wikify>

<% if [<currentTiddler>has[parent]] %>
<$let
  upChapter={{!!parent}}
>

<div style="text-align: center; clear: both; padding-top: 1em;">
  <% if [all[current] %>
    &uarr;&nbsp;
    <$link to=<<upChapter>>>
      <$text text={{{ [<upChapter>get[caption]] }}}/>
    </$link>
  <% endif %>
</div>
</$let>
<% endif %>