LinkIndexPlugin provides an index of inbound or outbound links for one, several, or all pages on the wiki. On outbound links this will also highlight any broken links (i.e., links to nonexistent wiki pages).


The direction of the link index, inbound ("in") or outbound ("out"). The default is "out".
dirstring='text string'
For displaying the link direction (like "<<< " for dir="in"). Default is "". Any markup characters are escaped.
When a page has no links, this is the descriptive text. The default is "no links". Any markup characters are escaped. [1]
When this parameter is absent, a link index of all wiki pages is returned. If a page parameter is supplied, only the links of that page are returned. More than one page can be specified when separated by whitespace. There is no default.


Some valid examples:

    [{LinkIndexPlugin page='Main' dir='in'}]
    [{LinkIndexPlugin page='Main About OneMinuteWiki' nolinktext='OMIT'}]
    [{LinkIndexPlugin page='Main' nolinktext='this page has no links'}]

The output will be a definition list having a class attribute value of 'linkindex', with a term and definition pair per wiki page. The term will contain the wiki page name as a link to the page, with the definition containing the list of links, with links to nonexistent pages in bold.

A typical output (as from the third line in the above example):

About, SandBox, Project Tattooine, WikiEtiquette, TextFormattingRules, JSPWikiTips, JSPWikiFAQ, System
Project Tattooine
ThisPageDoesNotExist, TextFormattingRules


This plugin is currently targeted as part of the JSPWiki core plugins, hence the Java file should be placed in src/com/ecyrd/jspwiki/plugin/ directory, and then the JSPWiki.jar is built and installed as normal.

Two minor modifications to com.ecyrd.jspwiki.WikiEngine are required: the getRefersTo() and getReferredBy() methods in WikiEngine are both currently protected; these must both be made public so that the plugin can get access to these two Maps.

You may want to additionally add something akin to the following to your jspwiki.css stylesheet:

  dl.linkindex       { margin-left:  2em; }
  dl.linkindex dt    { font-size:    120%; }
  dl.linkindex dd b  { color:        #800000; }
  .pluginerror       { color:        red; }


[#1] If the nolinktext parameter contains the special value "OMIT" (case insensitive), pages that have no links will be omitted from the index.

This plugin was developed and tested against JSPWiki 2.2.28.

Future Possibilities#

It might be nice to have a feature that only lists broken links. It wouldn't be that hard to add, and was (in actuality) the reason this plugin was first developed. It just grew into a full link index plugin because that was just as easy...


Please let me know if there are any bugs with this. -- MurrayAltheim

getRefersTo() and getReferredBy() are in com.ecyrd.jspwiki.ReferenceManager (and not in WikiEngine).

--Frank_Fischer, 2005-08-25

Here is an updated version:[Frank_Fischer-2005-08-27]#


  • all listed pages are links
    (dl.linkindex dd b is no longer used; broken links are covered with A.editpage)
  • added new parameter: view="all|broken"
    Lists all or only the broken links. Default is "all".
  • the listed pages are sorted and multiple occurrences are marked with a number (only when dir="out"):
    JanneJalkanen(4) means four links to JanneJalkanen
  • fixed java.lang.NullPointerException on rare occassions:
    col in Collection col = (Collection)map.get(key); was not always != null

--Frank_Fischer, 2005-08-27

Another update:[Frank_Fischer-2005-08-28]

Tested with: JSPWiki v2.3.15-cvs


  • fixed: view="broken" together with dir="in" displayed nonbroken links as well
  • new parameter: dirstring="text string"
    For displaying the link direction (like "<<< " for dir="in")
    Default is "".
  • 2006-05-25: updated to remove security risk on permitting raw HTML in parameters. In the current version any markup entered into the dirstring and nolinktext parameters is escaped.


links to undefined pages:
[{LinkIndexPlugin dir='out' dirstring='&gt;&gt;&gt; ' view='broken' nolinktext='OMIT'}]

Result looks like:#

links to undefined pages:
>>> undefinedPage1, undefinedPage2, undefinedPage3(2)
>>> undefinedPage1, undefinedPage2(3), undefinedPage3

Things that would be nice:#

  • multiple occurring pages should be marked with a number when dir="in"
  • listing links out of the wiki (mailto, http, ...). But this seems to be not easy.

--Frank_Fischer, 2005-08-28

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
java 8.1 kB 1 23-Aug-2005 19:10
java-20060525 10.8 kB 1 25-May-2006 04:27
java-frankfischer-2005-08-27 30.7 kB 3 09-Mar-2006 08:52
java-frankfischer-2005-08-28 10.1 kB 1 28-Aug-2005 10:55 FrankFischer
« This page (revision-40) was last changed on 10-Jun-2012 10:43 by Janne Jalkanen