Template:MakeIndex/doc

Description
This is a DPL (Dynamic Page List) template that generates an alphabetical index for items that have been designated using the P template. This is primarily intended for use in articles about a sourcebook or novel that could benefit from an index of some kind. You can index anything, but typically this will be creatures, characters, locations, magic items, etc. The output of this template is an alphabetical listing of the designated items with their page number(s).

Tagging Items
In an article, mark terms that you want to appear in the index like so: ... •  • Dire bear • Dire lion •  ... The P template will simply echo the first parameter, so  just looks like  to the reader. However, the second parameter is the page number(s) where death tyrants can be found in the sourcebook or novel. The sorting operates on the unlinked text of the first parameter, so normally  would be sorted as , which would put it in the R section of the index. The optional third parameter is a sortkey which will determine alphabetically where in the index the item appears. In the example above, "Deep Rothé" was added as the third parameter, so Deep Rothé will be listed under D instead of R.

Adding the Link
The index is generated dynamically when this template is called with a page name. To see the index, you need to place a link somewhere in the article that you are writing for the reader to click. A handy template called IndexLink will do this for you. Just place it where a reader can see it and voila, you are done. If you don't like the default link text, then you may modify it by supplying a new text string like so:

When a reader clicks the link, they are taken to the dynamically generated index page, which for our example looks somewhat like this: Page Index for PAGENAME. Name 	Page(s) Death tyrant 	13, 44, 46 Deep Rothé 	18 Displacer beast 102 PAGENAME will be a wiki link to the page that contains the index link. If for some reason you want to place a link in an article different than the one containing the P tags, then copy the following wiki code and replace  with the name of the page. [&action=purge Click here for index]