CodeDiscussionEditHistoryLinksLink count Subpages:DocumentationTestsResultsSandboxLive code All modules

This is the documentation page for Module:Catnav

For calling in template code use either

  1. {{#invoke:Catnav|main|<named_argument_list>}} or
  2. {{#invoke:Catnav|Q|<positional_argument_list>|<named_arguments_without_number_suffix>}} (putting named arguments before positional ones is fine too if your layout benefits)

The following doc is extensive. Usually things should just work. If you want to use this module for a template, start by looking at the examples. This module is intended to save template authors from typing and repeating the same phrases over and over again. If you find a bug, keep calm and if you will not fix it yourself, report it to the discussion page.

First case Second case
source of Template:Districts of Saxony for exemplary use see source of Template:Districts of Saxony/wikidata
named_argument_list is compatible with that of the legacy Template:Catnav, which served as an inspiration for this module. With default values given in braces and with X being replacable by a number in the range 0 to maxnum, the possible arguments are:
  • all or redlinks (), boolean
  • compact (), boolean
  • indent (), boolean
  • sort (1), boolean

  • imagealign (right)
  • imagewidth (30px)
  • imagestyle (), css
  • imagelink ()
  • image ()

  • iconsalign (left)
  • iconswidth (15px)
  • icons (), boolean or "only"
  • sep ()
  • prefix ()
  • article () or ("the" if all==2)
  • suffix ()
  • title ()
  • maxnum (99)

  • displayX ()
  • iconX ()
  • prefixX ()
  • articleX (article)
  • linkX ()
  • suffixX ()
  • noteX ()

For a given number X, variables with the same suffix X belong to the same entry.

To determine the link target of an entry, the value of linkX is taken literally. Should displayX be unset or empty, it is assigned the value of linkX.


If displayX contains i18n{x}, then i18n{x} will be substituted by a translation for x as found in TEMPLATE_PAGENAME/i18n, or x itself if translation failed.

Thereafter displayX is scanned for wikidata entity ids. Unless literal Q is quoted, using &#81;, let a positive integer prefixed with Q be Qm.

  • If Qm is not found in linkX, then it is substituted by its wikidata label.
  • Otherwise, as a literal of a page or category link, Qm is not necessarily a wikidata id and thus used unmodified.

For instance, with prefix=:Category:

  • displayX=Q4000|linkX=Q4000 will render as Q4000,
  • displayX=Q42|linkX=Q42 as Q42, but with displayX=q42 as Douglas Adams.
All named arguments that end in X, as described left, should not be passed in this mode as they may be overwritten internally by positional argument processing. Other named arguments may be used. The default value for prefix is :Category: in this mode.

positional_argument_list is expected to consist of valid wikidata ids. For each positional argument Qarg

  • property P373 (commons category) is looked up in wikidata to obtain a value for linkX
  • if linkX was set, displayX takes Qarg with Qm substitution done unconditionally
  • if icons ends in a wikidata property identifier, then that property of Qarg is looked up to set iconX

If no commons category (P373) could be found, then Qarg is used to set noteX, which may qualify as a seqlabel described below.

All positional arguments may be encased in simple wikitext formatting modifiers, i.e. '' or ''' should work to set the result of the lookup italic or bold.


The property identifier in icons is used to look up a commonsMedia filename for each Qarg. For instance

  • icons=only:P18 will render the image property of each Qarg as a linklabel exclusively. The entity label will be used as a fallback only if none is found or unusable.
  • icons=yes:P94 will attempt to use coats of arms images in combination with the entity label.
  • Consecutive runs of entries („sequences“) are detected if either displayX or linkX are continuously set (1st case), or settable by a successful lookup of an positional argument (2nd case), while X increments by 1. Sequences are surrounded by a div tag with class seqdata.
  • If a consecutive run is preceeded by a "lonely" noteY, then noteY is considered a seqlabel for the following seqdata div. (This is detected when displayX or linkX with X==Y+1 are set, while displayY and linkY are not.)
  • A unit of an optional seqlabel followed by seqdata is always enclosed in a div of class seq.
  • The default style for all seq, seqlabel and seqdata divs is display:inline, which means this data grouping has no visual effect.
  • If named argument indent is set or if users of this wiki style the data groups by means of their common.css settings, the default styling is overridden. In css rules, literal !important may need to be added to override the default.

icons acts as a master switch. If set to only, it turns off text display as long as an icon is available for a given entry. In the yes, true or 1 case it will put the icon next to the text given by argument displayX. Left or right icon placement can be determined for all icons by setting iconsalign accordingly, but a sensible default value is used.


sort=1, the default unless only icons are displayed, sorts each seqdata individually. It does so after all language translations have been done. For properly internationalized templates this results in a tidy appearance of the navigation list entries for each user language, not just the one the template was written in.

The sorting feature can be disabled explicitly using sort=no or sort=0 for all languages. Alternatively, by placing an additional key __sort__ in the /i18n helper template, it may be switched depending on the language used. This option was introduced, because template items may have a specific input ordering with respect to the native language a template was authored in. For example, |__sort__ = {{LangSwitch | default = yes | en = no}} enables the sort feature for all languages except English.

In compact mode (disabled by default) all seqlabel(s) are omitted and sort=once is additionally accepted. Sorting once will collect all items from all seqdata(s) and sort them into a single seqdata.