Backlinks are those links linking back to the current page. In DokuWiki you can see a list of pages linking to the current document by clicking at the pagename at the top.
By some ad hoc testing I discovered a constraint on page names: they have to start with at least 3 letters. Shorter names or those beginning with or containing in the first 3 characters some digits or things like underscore (_) are not fetched by DokuWiki´s backlink function on clicking a page´s name. I had no look into the code yet, it should be easily fixable. BTW: backlinks are a great invention (missing from HTML, as often remarked) that allows you to control your information net in both directions, esp. to see which expectations a reader may have by a backlinked page she or he may be coming from (using a forward link you may have explicitly set). hh
Note: this seems to apply only to older versions of DokuWiki. hh 2007-08-30
Backlinks do not work in any of the released versions of DokuWiki, but work on the development release. If you want to get backlinks working, it is a relatively trivial fix in the code. You need to change the ft_resultCombine function in /inc/fulltext.php.
So, this:
function ft_resultCombine($args){ $array_count = count($args); $result = array(); foreach ..../* more code here*/
Becomes this:
function ft_resultCombine($args){ $array_count = count($args); if($array_count == 1){ return $args[0]; } $result = array(); foreach ..../* more code here*/
Does not work with version 2005-09-22 ?
They weren't originally working for me but I tracked this down to a problem with the page indexing so searches were blank as well. If you use a template other that the default and the template was written before indexing was introduced you need to add<?php tpl_indexerWebBug()?>near the bottom of main.php in your template directoy on the line before</body>. Once I did this the backlinks worked. I did need to install the searchindex plugin to reindex the site as the index will only be added to as you visit pages otherwise. Hope this fixes your problem. chris hemsley
I use the default main template with the<?php tpl_indexerWebBug()?>just before the</body>. Backlinks doesn't work… Tried to reindex but that didn't fix the problem either.
I have a similar issue. When I indexed using the searchindex searches started working again, but Backlinks still don't. — Jonathan Arkell 2005-10-26 20:49
Yep - sorry for the confusion. I thought this fixed the problem but it seems I was just lucky enough to get a couple that worked. Backlinks on a number of other pages don't - Doh. Again sorry for the confusion. chris hemsley 2005-10-27 15:00
Ok, gonna submit a bug report on this now. — Thomas Atterbom 2005-10-28 13:12
I used the patch for fulltext.php and after that used searchindex, now things work for me (Dokuwiki 2005-09-22 on PHP 5.1.1 on IIS 6 on Win2003server) — Herman 2006-01-30 16:52
I can confirm this. Backlinks already worked with the WebBug enabled templates on pages that have more than one backlink. Applying the patch also showed backlinks correctly on pages wich only had one backlink (Dokuwiki 2005-09-22 on generic LAMP server using PHP5. — Clemens 2006-02-25 14:02
I had tracked down the fulltext.php issue and applied my own (equivalent) patch, but the problem was that the indexing was not happening, only one page was in page.idx, no updates for weeks! I use a custom template, and somehow had not noticed that it was necessary to insert something in main.php for the indexing which supports backlinks to work.
I am glad that the backlinks search now benefits from the maintenance and consultation of these index files (instead of searching all files each time…I was planning to install a trackback system, restricted to internal links, but may not bother now). I'm changing the main.php to not put 'do=backlinks' on the backlinks result page, and more generally use a 'select case' logic for the 'pagename' content; should I post the result somewhere? – DuckedApe 2006-03-26
I can see why backlinks would be useful for some applications, but they're not at all useful for mine. Is there an easy way to disable them? More specifically, I'd prefer the pagename at the top to just be there, and not be a link to anything. — Jonathan McBride 2007-08-13 16:55
You can disable them via the configuration manager (see disableactions). In order to remove the link of the pagename you have to edit themain.phpof your template and replace the following:
<div class="pagename"> [[<?php tpl_link(wl($ID,'do=backlink'),tpl_pagetitle($ID,true))?>]] </div>
with:
<div class="pagename"> [[<?php print tpl_pagetitle($ID,true)?>]] </div>
— Michael Klier 2007-08-13 17:49
Thanks! — Jonathan McBride 2007-08-15 19:24