Organizing backlinks

211 views
Skip to first unread message

Willem Hagendoorn

unread,
Apr 27, 2020, 3:18:32 AM4/27/20
to TiddlyWiki
Hi all!

Only yesterday I discovered TiddlyWiki, so I'm totally new to this. Since the possibilities are limitless, or so it seems, I was wondering if someone can help me out with the following.

I would like to organize the tiddler's backlinks and display them sorted by subject.

I also would like to show the specific fragment (and nothing else) the link is refering to in the list

For example:

--Tiddler--
About Human Rights

--References/backlinks--

+ Legislation
Tiddler about art. A, law Z
(Art. A mentions -Human Rights-)

Tiddler about art. B, law Z
(This art. can also be used when conducting research about -human rights-)


+ Case Law
Tiddler about case H
(textfragment -human rights-)

Tiddler about case I
(textfragment -human rights-)


+Literature
Tiddler about book A
(textfragment -human rights-)

Tiddler about book B
(textfragment -human rights-)


I hope this (or something similar) is possible! Can someone help me out? :)

Thanks!

Willem

Anne-Laure Le Cunff

unread,
Apr 27, 2020, 4:20:40 AM4/27/20
to TiddlyWiki
Hi Willem,

I assume you're using TiddlyBlink for your backlinks? If so I think there may be something to do in the $:/.giffmex/ViewTemplate/refstranscludecollapse file like this:

+ Case Law: <br>

<$list filter="[!is[system]all[current]backlinks[]!tag[hide]tag[caselaw]!tag[outlines]sort[title]] -[is[current]]"><$link><$view field="title"/></$link>

+ Literature: <br>

<$list filter="[!is[system]all[current]backlinks[]!tag[hide]tag[literature]!tag[outlines]sort[title]] -[is[current]]"><$link><$view field="title"/></$link> 

Hopefully David Gifford (who created TiddlyBlink) can jump in to confirm as I'm far from being an expert!

Willem Hagendoorn

unread,
Apr 27, 2020, 6:28:37 AM4/27/20
to tiddl...@googlegroups.com
Hey Anne-Laure,

Many thanks voor your suggestion and thank you for introducing TiddlyWiki in the Ness Labs newsletter! 

I'm using TiddlyBlink indeed, forgot to mention it. At the moment I have no clue what to do with the code yet, but I think I will manage to figure it out. If not, you will hear from me soon :)




Op maandag 27 april 2020 10:20:40 UTC+2 schreef Anne-Laure Le Cunff:

Anne-Laure Le Cunff

unread,
Apr 27, 2020, 6:47:52 AM4/27/20
to TiddlyWiki
Awesome - what I meant is go to the sidebar, then click on the "more" tab, then click on "System", then search for $:/.giffmex/ViewTemplate/refstranscludecollapse and open it in edit mode.

Have a look at the code there. It's the code that generates your reference list. You could paste the code I sent you under References: <br> and create a few articles with the tags caselaw or literature that link back to a specific page to test it.

I'm absolutely not sure my solution works, so please do a backup beforehand or try it on a copy of your current wiki.

Willem Hagendoorn

unread,
Apr 27, 2020, 7:12:57 AM4/27/20
to TiddlyWiki
Ah I see, great!

Your solution is getting me closer and closer, but I'm not there yet :)

First, I don't have the /refstranscludecollapse but the refstranscludeclean. 

Then, when I replace the code under References with yours, it only seems to work for the tag caselaw not for literature:


Schermafbeelding 2020-04-27 om 13.07.33.png


In a test, with two tiddlers tagged caselaw and two tiddlers tagged literature , bot linked to the Human Rights tiddler it looks like this:

Schermafbeelding 2020-04-27 om 13.08.51.png





Op maandag 27 april 2020 12:47:52 UTC+2 schreef Anne-Laure Le Cunff:

Anne-Laure Le Cunff

unread,
Apr 27, 2020, 9:18:08 AM4/27/20
to TiddlyWiki
Hi Willem,

Looking at the code in $:/.giffmex/ViewTemplate/refstranscludeclean it looks like this:

<$list filter="[!is[system]all[current]backlinks[]!tag[hide]!tag[outlines]sort[title]] -[is[current]]"><$link><$view field="title"/></$link><span class="indent1"><$link><span class="graybox"><$transclude field="text" mode="block" /></span></$link></span></$list>

The only thing I did was take what was in the file and add a new tag for each of your categories. You can try it too. So in your case it could be be:

+ Case Law:<br/>

<$list filter="[!is[system]all[current]backlinks[]!tag[hide]!tag[outlines]tag[caselaw]sort[title]] -[is[current]]"><$link><$view field="title"/></$link><span class="indent1"><$link><span class="graybox"><$transclude field="text" mode="block" /></span></$link></span></$list>

<br/>

+ Literature:<br/>

<$list filter="[!is[system]all[current]backlinks[]!tag[hide]!tag[outlines]tag[literature]sort[title]] -[is[current]]"><$link><$view field="title"/></$link><span class="indent1"><$link><span class="graybox"><$transclude field="text" mode="block" /></span></$link></span></$list>

Again, not sure this works but I imagine it would be the general idea.

David Gifford

unread,
Apr 27, 2020, 9:32:29 AM4/27/20
to TiddlyWiki
This does what you want, but with tagging:


I wonder if that could be done with linking.

si

unread,
Apr 27, 2020, 1:05:00 PM4/27/20
to tiddl...@googlegroups.com
Hi Willem,

Here is one of many possible approaches.

Create a tiddler, call it whatever you like, and add the following code:

\define list-backlinks(category)
<$set name="this-tiddler" value=<<currentTiddler>> >
<$list filter="[<currentTiddler>backlinks[]tag<__category__>last[]]">
<h3>''<<__category__>>''</h3>
</
$list>
<$list filter="[<currentTiddler>backlinks[]tag<__category__>]">
<$link><<currentTiddler>></$link>
<$context term=<<this-tiddler>> />
</
$list>
</$set>
\end

<hr>

<h2>''References''</
h2>

<<list-backlinks category:"Case Law">>

<<list-backlinks category:"Legislation">>

<<list-backlinks category:"Literature">>

Now tag this tiddler that you have just created with "$:/tags/ViewTemplate". Your lists should now appear at the bottom of every tiddler in your wiki. I am assuming that you are using the tags "Case Law", "Legislation" and "Literature".

Since you are using TiddlyBlink, you may wish to replace one of the references lists that are already featured. To do this, instead of creating your own tiddler, find the tiddler called "$:/.giffmex/ViewTemplate/refscontext" and replace the text with the above code. Remember to backup before doing this!

Then you will be able to view your category list by clicking on the eye button and selecting "search results in context".

Hopefully that works. Unless I made a mistake, which is very possible.

Willem Hagendoorn

unread,
Apr 28, 2020, 11:37:44 AM4/28/20
to TiddlyWiki
Thank you so much Anne Lauren, David and Si.

I've tested all your suggestion, it turns out that Anne Laurens solution works best for me. Besides the fact that this a solution to my question, it's a nice introduction in coding. Awesome. 

One more question: When the link refers to a tiddler with a lot of text, all text of that tiddler is shown in the 'simple transclusion mode':

Schermafbeelding 2020-04-28 om 17.33.51.png


Is it possible to show just the specific fragment/paragraph/sentence the link is refering to, and hide all the other text? So in the picture above, only the sixth paragraph would supposed to be visible. 

Thanks again!





Op maandag 27 april 2020 19:05:00 UTC+2 schreef si:

si

unread,
Apr 28, 2020, 12:16:22 PM4/28/20
to tiddl...@googlegroups.com
Hi Willem,

You can (almost) do this with the context plugin, which is already included in TiddlyBlink. I'm not sure if there's a way to specifically show a paragraph, but you can show any number of characters either side of a search result.

I had included it in my original solution, but you can apply the same thing to Anne-Laure's approach just as easily.

First you want to set your search term to be the title of the current tiddler, so surround all of your code with this:

<$set name="this-tiddler" value=<<currentTiddler>> >

...the rest of your code...

</$set>

Now instead of transcluding a tiddler you can use this:

<$context term=<<this-tiddler>> length="50" />

Where in this example you will see 50 characters either side of you search term.

Let me know if it works, si.

Willem Hagendoorn

unread,
Apr 28, 2020, 1:33:13 PM4/28/20
to TiddlyWiki

That was exactly what I needed! Thanks.

Last question (sorry :)): I tried to change the font of the results. I managed to change the color and adjust other style options, but I can't figure out how to change the font of the search results. Any ideas?

I have tried this code to change the color: works.

<$set name="this-tiddler" value=<<currentTiddler>> >
<$list filter="[!is[system]all[current]backlinks[]!tag[hide]!tag[outlines]tag[Case Law]sort[title]] -[is[current]]"><$link><$view field="title"/></$link><span class="indent1"></span><font color="blue"><$context term=<<this-tiddler>> length="50" /></font>
</$list>
</$set>

I have tried this code to change the font: doesn't work.

<$set name="this-tiddler" value=<<currentTiddler>> >
<$list filter="[!is[system]all[current]backlinks[]!tag[hide]!tag[outlines]tag[Case Law]sort[title]] -[is[current]]"><$link><$view field="title"/></$link><span class="indent1"></span><font face="arial">'<$context term=<<this-tiddler>> length="50" /></font>
</$list>
</$set>



Thanks again! Really appriciate your help!







Op dinsdag 28 april 2020 18:16:22 UTC+2 schreef si:

si

unread,
Apr 28, 2020, 2:07:10 PM4/28/20
to TiddlyWiki
Hi Willem,

I'm not a HTML/CSS person so someone else might have a better suggestion, but if you look at the page for the context plugin there is a section called "Customizing the output" which explains how you can use CSS to style the output.

N.B. There is a typo on that page - you need to use the tag "$:/tags/Stylesheet" with "Stylesheet" capitalized.

Anyway for your case you can create a tiddler, call it something useful and add this text:

.tw-context { font-family: Arial, Helvetica, sans-serif;}

Now tag it with "$:/tags/Stylesheet" and save. That seemed to work when I tested it.

Willem Hagendoorn

unread,
Apr 28, 2020, 3:38:19 PM4/28/20
to TiddlyWiki
You're the best. It works! Thank you all! :)



Op dinsdag 28 april 2020 20:07:10 UTC+2 schreef si:
Reply all
Reply to author
Forward
0 new messages