Can I add "backlinks" only when they are not in the main text already?

Hi.

I am completely new to TiddlyWiki and searched for options to automatically add “backlinks”. I somehow found this which lists all “backlinks” at the bottom of each tiddlr and used it for a while.

However, I’d like to limit this list to “backlinks” not already being part of the tiddlrs main text. I’d like pairs of tiddlers both already linking to each other not to redundantly appear in each others “backlink” list again.

Is there a way to achieve this? Sorry if I was just to stupid to use the right search terms or if this is easy. I unfortunatly don’t know HTML beyond the trivial basics yet.

You can use the filter operator “links[]” to remove the links already in your tiddler from the list you get with the “backlinks[]” operator :

{{{ [{!!title}backlinks[]] -[{!!title}links[]] }}}

Use this filter in a list widget for the ViewTemplate that will show your backlinks.

PS: Nice wiki !

2 Likes

Hi n0r,

Welcome to the community talk and TiddlyWiki. …

You found the right thing, and your search terms have been right too. … The function you envision is possible with a filter like this:

<$list filter='[is[current]backlinks[]limit[1]]' variable=dummy>
<hr>
Backlinks: <$list filter='[<currentTiddler>backlinks[]] -[<currentTiddler>links[]] +[butlast[]]'><$link><$view field="title"/></$link>,</$list>
<$list filter='[<currentTiddler>backlinks[]] -[<currentTiddler>links[]] +[last[]]'><$link><$view field="title"/></$link></$list>
</$list>

I did add -[<currentTiddler>links[]] which searches the current tiddler for existing links and “substracts” them from the existing list the backlinks operartor created.

I needed to move the +[butlast[]] element to the end, since it need to work with the “finished list”.

In the inner list I needed to move the +[last[]] run to the end for the same reason as butlast.

Also see: links operator and Filter Expression docs.

hope that helps.
I did test the code and it works for me.

have fun!
mario

1 Like

There is one problem with your “solution”. The term "Backlinks: " in the footer isn’t right anymore. … So you should go for a different one.

Thank you for your answers. I noticed that a tiddlr with all it’s backlinks already “done” still has the horizontal line and the “Backlinks:”-prefix. Not an issue though, I prefer it without them anyways and just got rid of them.

Not sure what a better term would have been anyway. The Idea is it is kind of a “todo” reminder at the bottom. My goal is to move any links down there up in the text, into context that explains the relevance of the other tiddler which linked “first”. Links with context are better then links without context, but links without context are better than one-way-links in my opinion. Since I will not always remember to link both ways, this is a reminder to link back manually.

Thanks for the welcome. And for the two links, at some point I would need to learn HTML anyways and doing that as a side effect of using tiddlywiki for notes is great. I’ll go and try to understand that code by looking up what it means now :slight_smile:

you would need to add the -[<currentTiddler>links[]] to the very first list-widget too

1 Like

The list of all filter operators is at: https://tiddlywiki.com/#Filter%20Operators … You can search for the operators in the filter syntax and also have a look at the example tiddlers.

You can play with the operators a bit to see how they work.

If you have more questions, just ask here or with new threads. … No problem.

I would recommend taking a look at this section of Grok TiddlyWiki as well. It shows you how to build a list of backlinks and links with excerpts from the tiddlers being linked. The site is excellent for building your understanding of TiddlyWiki.

Thanks. While the idea is a good one to include an exerpt, this would lead to visual segmentation of the individual tiddlers, which I’d like to avoid. I want my tiddlers to be simplistic: just 3-5 text paragraphs, each explaining an aspect of the tiddlers topic, each providing the context for 0-2 links.

The link list at the bottom is an indicator, a little reminder. If it has more than 3 items, it means this tiddlers topic is important (often referenced) and should be expanded, possibly broken in multiple tiddlers.

Adding additional automated text to those links would both be beyond the scope of the lists purpose (“Hey, incoming reference, what do you want to do with it?”) and adding much visually to the tiddlr fighting with the main text for the readers (my) attention who is supposed to focus on the main content.

It is very possible that my approach to notetaking and making a personal wiki is a terrible one shaped by the tools I used before. For now, this is how I’d like to it and I might embrace other options down the road.

Also yes, Grok TiddlyWiki is very informative (and also slightly intimidating), bookmarked it.

1 Like

In case anyone is interested, this is the very simplified version I’ve settled on:

<small>
<$list filter='[<currentTiddler>backlinks[]] -[<currentTiddler>links[]]'><$link>↖<$view field="title"/></$link> </$list>
</small>

No, that makes sense! Note-taking is a very personal thing, there is no right or wrong way. Something that works for one person may not work for another.

Welcome to the community, by the way!

1 Like

As a result of this thread I have started a personal project to have an easy way to add contents to tiddlers via a small button bar that toggles more content if needed, without disrupting the button bar. In this case you would tag your backlink display with a custom tag then a button would appear only if you had backlinks and clicking it would reveal them.

This sounds useful. Looking forward to seeing it!

  • You may have seen it by now but I wasted an hour or more because I accidently terminated a macro with /end not \end arghhh

I feel your pain. I spent too much time troubleshooting something today, just to discover I was missing a “$”. I may need to look into a syntax highlighting plugin.