Template:Listref/doc

This template creates in-text citations and a reference list for use in list articles as a supplement to the standard footnote system. It is intended for use only for references used a large number of times. The template is styled to render in-text citations and the reference list like the tags and reflist template used by the footnote system.

Differences:
 * There is no backlink from the citation in the reference list, by design.
 * The in-text citation uses a standard HTML link without an id, by design. Other templates create an HTML id, which is only allowed to be defined once, thus multiple uses of the same in-text citation results in invalid HTML
 * The in-text citation link and the anchor in the reference list are created manually.

Likenesses:
 * In-text citations use the same style.
 * The reference list uses the same marking and font size.
 * The citation in the reference list is highlighted when the in-text citation is followed.
 * The reference list can be formatted with columns like reflist.

The problem
List articles often use a single named reference a large number of times. Each use creates a backlink in the reference list entry and eventually the backlinks become ugly and useless. For example:



Examples:
 * List of Eagle Scouts
 * List of islands of Maine
 * List of philosophers (A–C)

In-text citation
creates the in-text citation link using the first unnamed parameter. This will define both the superscript callout text ([a]) and the link id. If undefined, it defaults to a.

Examples:
 * shows as
 * shows as
 * shows as

Although any characters can be used, only these styles will link to citations in the reference list:
 * lower-alpha
 * upper-alpha
 * lower-roman
 * upper-roman
 * lower-greek
 * decimal

To include a page number use p


 * shows as

Reference list
The citations are defined in and the reference list is displayed with. There are two named parameters for up to nine citations:
 * id1 through id9 matches the link id set with listref.
 * ref1 through ref9 defines the full citation.

supports style parameters similar to reflist:
 * Columns: Using will automatically choose the number of columns based on the width of the web browser. You can set this to match the columns parameter in reflist.
 * List style: The reference list is styled as lower-alpha by default. It can be changed with liststyle to:
 * upper-alpha
 * lower-roman
 * upper-roman
 * lower-greek
 * decimal


 * The style must match the in-text link id style.

Citations in the reference list must be in the proper order for the superscript links to function.

Freestyle
You can use any text for the label by setting square. The reference list will show as an unordered list and the label will show in the reference list at the beginning of each entry enclosed by brackets.

Examples
Default using letters


 * The brontosaurus is thin at one end.
 * Then it becomes much thicker in the middle.
 * The Norwegian Blue Parrot will not move if its feet are nailed to the perch.
 * Its metabolic processes are a matter of interest only to historians.
 * The brontosaurus is thin at one end.
 * Then it becomes much thicker in the middle.
 * The Norwegian Blue Parrot will not move if its feet are nailed to the perch.
 * Its metabolic processes are a matter of interest only to historians.

Roman numeral labels
 * The brontosaurus is thin at one end.
 * Then it becomes much thicker in the middle.
 * The Norwegian Blue Parrot will not move if its feet are nailed to the perch.
 * Its metabolic processes are a matter of interest only to historians.
 * The brontosaurus is thin at one end.
 * Then it becomes much thicker in the middle.
 * The Norwegian Blue Parrot will not move if its feet are nailed to the perch.
 * Its metabolic processes are a matter of interest only to historians.

Freestyle labels Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
 * The brontosaurus is thin at one end.
 * Then it becomes much thicker in the middle.
 * The Norwegian Blue Parrot will not move if its feet are nailed to the perch.
 * Its metabolic processes are a matter of interest only to historians.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
 * The brontosaurus is thin at one end.
 * Then it becomes much thicker in the middle.
 * The Norwegian Blue Parrot will not move if its feet are nailed to the perch.
 * Its metabolic processes are a matter of interest only to historians.

Troubleshooting
With manual links it is easy to introduce errors such as duplicate anchors and unused references. The script User:Trappist the monk/HarvErrors will show many related errors. Duplicate anchors may be found by using the W3C Markup Validation Service.

MediaWiki:ListrefErrors.js

After installing the script, errors should show in this test:


 * In-text use of listref that does not link.

Bug
The issue with over-backlinking has been reported as Cite extension: suppress backlink. If the extension is updated, then this template should be deprecated.