One of my personal TiddlyWiki’s contains song lyrics and chords, with the default tiddler displaying a list of the songs sorted by title. It’s been annoying for a long time that the titles starting “The …” are sorted under “T”, and not the first letter of the following word.
The new sortsub operator in v5.1.23 has provided a simple means to resolve things:
\define sort-filter() [<currentTiddler>removeprefix[the ]] ~[<currentTiddler>removeprefix[The ]] ~[<currentTiddler>]
<$list filter="[tag[song]sortsub<sort-filter>]" template="$:/_SongItemTemplate"/>
The subfilter relies on the fact that the removeprefix operator doesn’t return anything if the input string doesn’t start with the specified prefix. Thus we can step through the prefixes we want to remove, finishing up with the original title.
A more complete version should perhaps strip the prefix “A ” as well.
It would be nicer if we have a case-insensitive version of removeprefix.
Best wishes
Jeremy