18th November 2020 at 10:33am
These examples make use of the following variables:
- compare-by-title-length:
[length[]]
- compare-by-text-length:
[get[text]else[]length[]]
- compare-by-newest-of-modified-and-created-dates:
[get[modified]else[19700101]]
[sortsub:number<compare-by-title-length>limit[10]]
[!sortsub:number<compare-by-title-length>limit[10]]
[sortsub:number<compare-by-text-length>limit[10]]
[!sortsub:number<compare-by-text-length>limit[10]]
[tag[Field Operators]sortsub:date<compare-by-newest-of-modified-and-created-dates>]
You can use the search-replace Operator in combination with the sortsub Operator to ignore stop words like "A" and "The" at the beginning of titles when sorting. (Note for example that "A Tale of Two Cities" sorts under "T" rather than "A")
[enlist<book-list>sortsub<compare-without-stopwords>]
You can also customise the listing so that "A Tale of Two Cities" is listed as "Tale of Two Cities, A" but still links to the correct tiddler.
<ul>
<$list filter="[enlist<book-list>sortsub<compare-without-stopwords>]">
<li><$link><$text text={{{[<currentTiddler>search-replace:i:regexp[(^The |A )(.*)],[$2, $1]]}}}/></$link></li>
</$list>
</ul>
That renders as: