The “Recent tiddlers” sidebar list output is generated by the <<timeline>>
macro (see $:/core/macros/timeline
).
This macro already has some infrastructure for customizing the output. Take note of the first few lines of the macro definition:
<!-- Override one or both of the following two macros with a global or local macro of the same name
if you need to change how titles are displayed on a timeline -->
\define timeline-title() <$view field="title"/>
\define timeline-link() <$link to={{!!title}}><<timeline-title>></$link>
Thus, you can create a tiddler (e.g., MyTimeline
), tagged with $:/tags/Macro
, containing something like this:
\define timeline-link()
<$link/>
<pre style="margin:0 1em;font-size:80%;line-height:1em;color:initial;white-space:normal;">
<$let excerpt={{{ [{!!text}split[]limit[100]join[]] }}}><<excerpt>></$let>
</pre>
\end
The result is that the “Recent” sidebar list will show each title, followed by a 100-character excerpt of that tiddler’s content.
A similar (but slightly more involved) approach can be used to customize the search results output.
- Start by cloning the
$:/core/ui/DefaultSearchResultList
tiddler.
- Give it a new title (e.g.,
MySearchResults
)
- Change the
caption
field to something like Excerpts
- Completely replace the
text
field contents with:
\define searchResultsExcerpt()
<pre style="margin:0 1em;font-size:80%;line-height:1em;color:initial;white-space:normal;">
<$let excerpt={{{ [{!!text}split[]limit[100]join[]] }}}><<excerpt>></$let>
</pre>
\end
{{$:/core/ui/DefaultSearchResultList}}
- Then, edit the shadow tiddler
$:/core/ui/ListItemTemplate
- Change the
text
field contents from:
<div class="tc-menu-list-item"><$link /></div>
to
<div class="tc-menu-list-item"><$link /><<searchResultsExcerpt>></div>
You will now have an additional tab displayed in the sidebar search results. The second tab (called “Excerpts”) will show the same lists as the $:/core/ui/DefaultSearchResultList
, but with the addition of a 100-character excerpt of each tiddler’s contents.
enjoy,
-e