Template:Compact sub-TOC
| This template is rated as alpha. It is ready for limited use and third-party feedback. It may be used on a small number of pages, but should be monitored closely. Suggestions for new features or adjustments to input and output are welcome. |
This template may be used to create a secondary compact Table of Contents to link directly into a densely populated portion of a large category with a highly skewed distribution where many entries all begin with the same two- or three-letter prefix, via a–z links into that section; that is, to prefix+a, through prefix+z.
Usage
[edit]{{Compact user warning TOC|prefix=prefix}}
{{Compact user warning TOC|prefix=prefix|name=your heading here}}
Features
[edit]- This template is intended for use after a {{Compact TOC}} just above it on a page with many entries. As this template targets only a fraction of entries in a category, it generally should never be used alone.
- It can be used more than once on the same page, with different prefixes to target different subsets of entries. For example, one could use
|prefix=db-to target all entries starting withdb-, and|prefix=uw-to target all entries starting withuw-. See § example 5. - As in {{Compact TOC}}, the sub-compact format goes sideways: a b c d e f g h i j k l .... Lower-case index letters helps distinguish it from {{Compact TOC}}.
- The heading "sub-contents..." can go on top (default) or on the side (
|side=yes). - Some letters can be omitted, instead of 26 separate letters.
- It can be used remotely, e.g. on a Talk page, by use of param
|page=.
When to use
[edit]This template is designed especially for use with large categories with a highly skewed distribution which would otherwise require much next-paging to reach a desired point in a category page containing a large number of pagenames all starting with the same prefix, and where the skew is too great to make {{Large category TOC}} useful, the latter being both insufficient for the prefix area, and overkill everywhere else. If you have a few thousand entries spread roughly evenly throughout except for a thousand of them all bunched together under the same two- or three-letter prefix, that is a very large skew and may benefit by using this template to generate a sub-TOC underneath the main {{Compact TOC}}.
The canonical usage example is in categories that contain many user warning template entries (which all start with Uw-) as well as many other scattered entries. Instead of having to next-page many times through the category entries after hitting 'U' in the main TOC to find them, a compact sub-TOC provides direct access to all of the warning templates from the first category page via the 26 'a' to 'z' links in the sub-TOC, which go straight to entries starting with 'uw-a' through 'uw-z'.
When not to use
[edit]For categories less than 1,200 entries, no matter how skewed, that's only six pages' worth, so {{Compact TOC}} is often enough. For very large categories with more or less even distributions, {{Large category TOC}} makes more sense, even if the distribution is somewhat "lumpy".
Parameters
[edit]Unique
[edit]There are three named parameters unique to this template; one required, and two optional:
|prefix=– the prefix to use before A to Z to jump into the category listing (required; no default; see § examples below; e.g.:uw-)|long=y– extends the letter links by including the prefix, e.g., uw-a · uw-b · uw-c ·... instead of just a · b · c ·... etc. (see § Example 3)|page=– name of the category page[a] (optional; default: the PAGENAME; suggested: omit it)
Pass-through
[edit]These are all optional, and work as described at Template:Compact TOC:
Style params
[edit]There are five optional style params passed through to {{Compact TOC}}:
|name=– replaces the default heading "sub-contents for prefix ..."; valuenonesuppresses the heading. (see examples § 4 and § 5)|top=yes– enable the "Top" link; this is only useful if the sub-TOC is not near the top of the page|center=yes– center the sub-TOC horizontally|right=yes– align the sub-TOC to the right side of the page|side=yes– place the name (label) to the side of the links and on the same line with them; see § Example 2
Letter params
[edit]There are 26 pass-through letter params (all optional)[b]:
|a=– where to jump to in the category list (optional; default: value ofprefix+ 'a' )|b=– where to jump to in the category list (optional; default: value ofprefix+ 'b' )
- ... and so on...
|z=– where to jump to in the category list (optional; default: value ofprefix+ 'z' )
The letter params |a= through |z= jump to prefix + letter in the category list. So, if |prefix=uw- then sub-TOC letter m jumps to the first page in the category with entries starting with uw-m.
Normally, you can leave out all the letter params. If you supply them, they override the default, as they do in {{Compact TOC}}. For example, you could include a few adjacent letters and set them to empty, in order to skip letters like one might do with |x= |y= |z= when there aren't a lot of entries beginning with those letters, and you want to group them in the sub-TOC with an 'XYZ' link instead.
Examples
[edit]1. {{Compact sub-TOC|prefix=uw-}} |
|---|
{{Compact sub-TOC|prefix=uw-|page=Templates with matching hidden id}} → |
2. {{Compact sub-TOC|prefix=uw-|side=yes}} |
|---|
{{Compact sub-TOC|prefix=uw-|side=yes|page=Templates with matching hidden id}} → |
3. {{Compact sub-TOC|prefix=uw-|long=y}} |
|---|
{{Compact sub-TOC|prefix=uw-|long=y|page=Templates with matching hidden id}} → |
4. {{Compact sub-TOC|prefix=uw-|top=yes|name=direct links to warning templates}} |
|---|
{{Compact sub-TOC|prefix=uw-|top=yes|page=Templates with matching hidden id|name=direct links to warning templates}} → |
See also
[edit]- Help:TOC
- {{Compact TOC}}
- {{Horizontal TOC}}
- {{Category TOC}}
- {{Large category TOC}}
- {{TOC limit}}
- {{TOC hidden}}
Notes
[edit]- ↑ Other namespaces is a planned enhancement.
- ↑ The concatenation of the prefix value and the letter param defines the&from point in the query string of category page url.