Page for recent tiddlers displays captions instead of titles

65 views
Skip to first unread message

Anne-Laure Le Cunff

unread,
Apr 24, 2020, 3:22:58 PM4/24/20
to TiddlyWiki
Hi everyone,

I want to create a page displaying the most recently edited tiddlers.

This is my code:

<<list-links filter:"[!is[system]!sort[edited]]-[tag[hide]]-[tag[meta]]">>

The weird thing that happens is that it gives me the list of most recently edited tiddlers, but displays their caption field instead of their title (see screenshot attached).

Looked everywhere and can't figure it out. What am I doing wrong?

Thank you for your help!

p.s. I'm aware there is a "recent" tab which is super helpful, but this is for exporting as a static website.
screenshot-recent-posts.png

Mark S.

unread,
Apr 24, 2020, 3:47:44 PM4/24/20
to TiddlyWiki
That's by design:

From TiddlyWiki.com:

If a tiddler has a caption field, this is shown instead of the tiddler's title. If the caption field is empty, a blank entry is shown.

This is where you start to learn about the list widget ;-)

Eric Shulman

unread,
Apr 24, 2020, 3:52:14 PM4/24/20
to TiddlyWiki
On Friday, April 24, 2020 at 12:22:58 PM UTC-7, Anne-Laure Le Cunff wrote:
I want to create a page displaying the most recently edited tiddlers.
This is my code:
<<list-links filter:"[!is[system]!sort[edited]]-[tag[hide]]-[tag[meta]]">>
The weird thing that happens is that it gives me the list of most recently edited tiddlers, but displays their caption field instead of their title (see screenshot attached).

The list-links macro is defined here: $:/core/macros/list
\define list-links(filter,type:"ul",subtype:"li",class:"",emptyMessage)
\whitespace trim
<$type$ class="$class$">
<$list filter="$filter$" emptyMessage=<<__emptyMessage__>>>
<$subtype$>
<$link to={{!!title}}>
<$transclude field="caption">
<$view field="title"/>
</$transclude>
</
$link>
</$subtype$>
</
$list>
</$type$>
\end

Note these lines:
<$transclude field="caption">
<$view field="title"/>
</$transclude>

What this means:
The $transclude widget will show the caption text of the tiddler.  If there is no caption field defined, it falls back to showing the title of the tiddler.

What you can do:
Instead of using the <<list-link>> macro, you can create your own output using the <$list> widget.  Something like this:
<$list filter="[!is[system]!sort[edited]] -[tag[hide]] -[tag[meta]]">
   
<li><$link /></li>
</$list>

notes:
* in your posted code, you used "!sort[edited]"... however, unless you are creating that field yourself, there is no such field by default.  When you edit a tiddler, the TWCore automatically updates a field called "modified"
* the list that is generated will include *all* tiddlers in the document.  If there are a lot of tiddlers, the list will be very long (e.g., try this on tiddlywiki.com, and you will get 1258 items!).  You can use the [limit[...]] filter to keep the list from being too long.

Thus, to only show the 50 most recent changes:
<$list filter="[!is[system]!sort[modified]] -[tag[hide]] -[tag[meta]] +[limit[50]]">
   
<li><$link /></li>
</$list>

enjoy,
-e
Eric Shulman
TiddlyTools.com - "Small Tools for Big Ideas!" (tm)

Anne-Laure Le Cunff

unread,
Apr 24, 2020, 4:14:26 PM4/24/20
to TiddlyWiki
Wow, both - thank you so much!

Eric, the detailed explanation was incredibly helpful. (and it did work)

Very grateful, thank you!

Anne-Laure Le Cunff

unread,
Apr 24, 2020, 4:53:53 PM4/24/20
to TiddlyWiki
Sorry to re-open this, but now all of my backlinks also use the caption, see sidebar here. What a weird behaviour! I want the caption to be the caption and the title to be the title.

The only reason I added a caption was so I could add a meta description for search engines with {{!caption} — is there another way I should go about this?

Thanks so much!

Anne-Laure Le Cunff

unread,
Apr 24, 2020, 4:57:10 PM4/24/20
to TiddlyWiki
Oh - never mind. Sorry about the double post. Seems like I need to use "description" and not "caption" — thanks again for your help!
Reply all
Reply to author
Forward
0 new messages