Open main menu

UESPWiki β


< UESPWiki

UespCustomCode is a Mediawiki extension written for UESP that provides several wiki customizations specifically written to handle some of UESP's unusual requirements. Many of the customizations are designed to make UESP's Namespaces work more smoothly.

This is one of several custom extensions on UESP: see MetaTemplate and Active Users for documentation on the other extensions.

Magic WordsEdit

See Help:Magic Words for descriptions of the following magic words.


  • NS_ID



Parser FunctionsEdit


This parser function removes any text in parentheses at the end of a page name.

Example: {{#label:{{PAGENAME}}}} used on Lore:Vivec (god) would produce "Vivec".


This parser function takes a page name and moves the words "A", "An", or "The" at the beginning of the page name to the end.

Example: {{#sortable:{{PAGENAME}}}} used on Lore:The True Nature of Orcs would produce "True Nature of Orcs, The".

Bread Crumb Trail SubroutinesEdit

Three parser subroutines, {{#inittrail}}, {{#settrail}}, and {{#addtotrail}}, can be used to generate a bread crumb trail for an article. The subroutines do not insert any text at the location where they appear in the document. Rather, if one of these functions is used in an article, then the resulting bread crumb trail is inserted in the upper left corner of the article, in the location and format used on subpages to provide links to the parent article.

All three subroutines take any number of links as arguments. If the arguments already are links, then the links are used as is; otherwise, the arguments are each converted into a link using the article's default namespace (e.g., the argument "link" would be converted into [[{{NS_FULL}}link|link]]). The same rules used by the various UESPNamespace functions are used to establish the default namespace for the article. Each link that is added to the trail is separated from the previous trail entries by a separator. By default, the separator is ": ".

All three subroutines also recognize several optional arguments:

  • |if=<condition>: execution of the subroutine only occurs if the <condition> is true (see Conditional Expressions for details).
  • |ifnot=<condition>: execution of the subroutine only occurs if the <condition> is false.
  • |ns=<namespace>: sets the default namespace for the bread crumb trail to the provided <namespace>. <namespace> can either be the namespace's base name (NS_BASE) or ID (NS_ID). If a namespace has been specified using |ns=, it applies to all of the arguments for that function (including any arguments that precede the |ns= argument). It also remains the default namespace for any subsequent bread crumb trail subroutines, unless those functions specify a new namespace.
  • |separator=: sets the default separator to use when appending new elements to the bread crumb trail. The default value is ": ". If a separator is specified, it applies to all of the arguments for that function (including any arguments that precede the |separator= argument). However, the separator does not automatically rollover to any subsequent bread crumb trail subroutines.
    • To include spaces in the separator, it needs to be enclosed in quotes (single or double); otherwise the wiki processing will automatically strip any spaces from the end of the string. The quote marks are not considered to be part of the separator.
    • To include a pipe (|) in the separator, use an exclamation point (!) instead. (An actual pipe character would be misinterpreted by the wiki parser).


Example: {{#inittrail:Items}} placed on a page such as Oblivion:Weapons would create the trail: Oblivion: Items

#inittrail is the standard subroutine used to construct a bread crumb trail, and for most articles will be the only bread crumb subroutine that is necessary. It initializes the bread crumb trail using the value of {{NS_TRAIL}} appropriate for the default namespace (if |ns=<namespace> is one of the arguments to #inittrail, that will be the namespace used for NS_TRAIL). Any previously-generated bread crumb trail for this article is discarded.

Arguments (if any) will be appended to NS_TRAIL.


Example: {{#settrail:Oblivion|Items}} placed on a page such as Oblivion:Weapons would create the trail: Oblivion: Items

#settrail initializes the bread crumb trail by blanking it, discarding any previously-generated bread crumb trail for the article. A new trail is then constructed using the provided arguments. #settrail is only appropriate in rare cases where NS_TRAIL should not be used.


Example: {{#addtotrail:Magic|separator=' / '}} placed on a page following {{#inittrail:Items}} would create the trail: Oblivion: Items / Magic

#addtotrail is used to add additional elements to a previously defined trail. In particular, if a template provides the standard trail for a set of pages, #addtotrail can be used to add to the standard trail on individual pages that need additional customization.

Category SortingEdit

The default category sorting has been modified to work with pseudo-namespaces. Both in and out of pseudo-spaces, the default sort key will also be run through #sortable. Thus, Oblivion Mod:Stirk/The Alchemist's Guide to Skooma appears under A (not S or T), since it takes "The Alchemist's Guide to Skooma" as the title and moves the "The" to the end, so the sort key becomes "Alchemist's Guild to Skooma, The".

Search FunctionEdit

The specifics of the changes to the search function have not yet been documented.

Special PagesEdit

The specifics of the changes to Special Pages have not yet been documented completely.


  • With version 0.7
    • The list of namespaces in the search box can be customized through the 'uesppowersearchtable' special message; other text associated with the search box can also be customized through various other special messages.
    • The "Search" tab under Special:Preferences now uses the same layout as the search page for selecting namespaces, and also allows users to set preferences for other search-related settings.
    • The "Go" button now handles searches such as "Oblivion Artifacts". To limit problems with ambiguity, "Go" first checks to see whether there is an article with the given title. If no matches are found, then the search will check to see whether the first word of the search is a namespace; if so, the namespace is removed from the title and instead used as the match condition for the namespace.
    • Title searches (using "Search" not "Go") for searches such as "Oblivion Artifacts" will eventually work, too. However, for this feature to work, the articles need to be re-indexed -- in other words, each article's search information will be updated when that article is edited. A purge is not enough, and probably an indirect article update (through a template edit) isn't enough either. So it might take a while before any significant fraction of articles are updated.
    • An attempt has been made to improve the sort order used for search matches. Title matches are being sorted by the length of the title (shortest titles first), then in reverse namespace order (highest namespace numbers first). Text matches are being sorted by match relevance, with the most relevant first. However, the details of how relevance is calculated are somewhat obscure (i.e., it's not just number of matches, but number of matches relative to the length of the article; words in the search are weighted according to commonness). It'll take some time to see how successful the algorithm is in practice -- but it can't be any worse than the current searches, which are completely unsorted.
    • Fixed bug with UESPWiki namespace on search page
    • Fixed bug in regexp in SearchUpdate.php
  • From version 0.7 to version 0.9.1
    • Two new features added to recent changes page: "Hide most userspace edits" and "Turn on custom namespace list", along with interface for customizing the features under Special:Preferences
    • Minor tweak to prefs.js to improve access to Special:Preferences (tweak not yet active on UESP)
    • "Userspace patroller" group created, with the ability to patrol only edits in the user and user talk namespaces (technically, the standard 'patrol' right is now only effective in user and user talk namespaces; an additional 'allspacepatrol' right was created and given the rights to patrol all namespaces; the 'allspacepatrol' right has been given to the existing patroller and sysop groups).
    • "Hide patrolled edits" available to all registered users from recent changes page
    • Search function query modified to try to improve performance of fulltext searches. Previously, most other queries were locked each time a fulltext search ran, in particular while the DB sorted the results, which could take several seconds. Query modified to use temporary table for sorting; will monitor to see whether locking problems are resolved.