Use of the caption field

Happy New Year to all celebrating it!

I have two simple questions and would appreciate your help.

  1. Is it true that if I use a link like [[Alice Blakely]] and that tiddler has a caption field = Alice then I will still see “Alice Blakely” as the output and not the caption value (“Alice”)?

  2. Corollary to the above, the field caption is used in other conditions?

!. You are right. The output will be a link to that tiddler with the complete name of the tiddler (not the caption).
2. If you use table of contents code like <<toc "piano-lesson">> and the Alice Blakely tiddler is tagged “piano-lesson”, then the list of all tiddlers with that tag will display “Alice”, the caption, instead of that tiddler’s whole title.

I’m sure there are other uses for the caption field but in my personal use, that is where I know it is useful. Someone else, better informed, will hopefully detail other uses.

2 Likes

As @Gb7b5 noted, it is true that the title is the main display, but caption is used in place of it in some circumstances. You can add others pretty easily. For instance, if you want to use the caption in place of the title at the top of the tiddler view, there are techniques for this, including the recent suggestion from @springer, or a slightly simpler version with these two tiddlers:

title: $:/_/my/config/ViewTemplateTitleFilters/caption
tags: $:/tags/ViewTemplateTitleFilter
list-before: $:/config/ViewTemplateTitleFilters/default

[<currentTiddler>has[caption]then[$:/_/my/core/ui/ViewTemplate/title/caption]]
title: $:/_/my/core/ui/ViewTemplate/title/caption

\whitespace trim
<h2 class="tc-title">
<$view field="caption"/>
</h2>

Or, if you want certain links to use the caption rather than the title, you can write a tiny tool for that, with something like:

\procedure caplink(title) 
  <$link to=<<title>> >
    <$view tiddler=<<title>> field="caption"><$view tiddler=<<title>> field="title"/></$view>
  </$link>
\end

to be used like this:

* ''link'': [[abs Operator]]
* ''caplink'': <<caplink "abs Operator">>

which yields this:

image

caplink.json (377 Bytes)

2 Likes

@Scott_Sauyet and @Gb7b5 have covered the “core” answer pretty thoroughly, but in case you want your wikitext links to use the caption field rather than the title by default, I want to plug @pmario’s uni-link plugin. It offers a number of expanded link possibilities, but one of my favorite “less obvious” features is this config option:

Misinformation preserved for posterity. You will still need Scott or Springer's workarounds if you want captions displayed as tiddler titles.

As an added bonus, if you turn on the core tiddler-titles-as-links setting (Control Panel > Settings > TiddlyWiki)

image

… you get the benefit of Scott’s suggestion here…

… without needing to make any additional changes.

3 Likes

Oops, you’re right. I’ve hacked my copy of uni-link (and the title cascade, for that matter) fairly significantly and I install the same plugin package on all my wikis, so I forgot it doesn’t work that way out of the box. :sweat_smile:

I’ve corrected my previous post. Thank you for doing my due diligence for me!

1 Like

Damn, I was hoping to be taught something interesting here! I deleted my post, as it’s now unnecessary. (And I love the misinformation preservation technique! That seems the perfect way to deal with something like this.)

1 Like

Really… That’s cool. I did implement it and after some time I found out, that I personally do not like it, because it is a global setting.

I prefer [[alias-link|?c]], which does the same thing, but I can control it on a per link basis.
I also use ´[[alias-link|?s]]´ for subtitle field, which probably is common for my personal wikis.

But the important thing is … you have the choice :wink:
-m

3 Likes

I can certainly understand that point of view. Personally, I have a lot of titles chosen primarily for uniqueness or sorting purposes with their “display title” in caption, so the global setting handles my intended usage 95% of the time. But occasionally I do want a link to display the title field, not the caption, so I modified your <<aka>> macro so that [[Alias link|?]] looks for

  1. a tiddler with title Alias link
  2. a tiddler with title alias link
  3. a tiddler with [[alias link]] (or [[Alias Link]], etc.) in its aliases field.

This covers several “edge” cases for me:

  • Instances in which I want to link to a tiddler that has a caption, but display the real title
  • Instances in which I want to link to a lowercase tiddler title like alias link at the beginning of a sentence — so I don’t have to add an alias to every lowercase title
  • Instances in which I want to link to a missing/likely future tiddler, but I don’t want to precommit to a specific title. This lets me type [[Alias links|?]], knowing that it will “just work” later, whether I end up creating a tiddler “Alias links”, a tiddler “alias links”, or a tiddler “alias link” with the plural in aliases.

I’m sure this all diverges significantly from your own usage of uni-link, but it works splendidly for me. Thank you very much for creating such a flexible and extensible tool!

1 Like