This is a documentation subpage for Template:Shortcut compact. It may contain usage information, categories and other content that is not part of the original template page. |
{{Shortcut compact}} is a compact version of the {{shortcut}} template, for use in vertically-constrained locations, such as alongside list items.
It flows to the right of the page, displaying all the shortcuts in a single line of text.
Usage
editUsage is similar to the {{shortcut}} template, see full documentation there. This template accepts up to five shortcuts as parameters. However, in most cases you will only want to display one or two shortcuts with this template, otherwise it may get too wide. Use {{shortcut}} if you need to display more than two shortcuts in the same box.
Originally this template is for use on the Editor's index, which needs to display shortcuts alongside list items and subitems which are vertically close together. The goal is to make the Editor's index more useful as a tool for answering questions, for example on the Help desk. A user can look up entries on the Editor's index, copy the relevant shortcuts, and paste them into links in replies to Help desk questions.
The template may be useful on other pages where multiple shortcut boxes would crowd together vertically.
Examples
editCode | Result |
---|---|
{{Shortcut compact|WP:V}}
|
|
{{Shortcut compact|WP:V|WP:VERIFY|WP:SOURCE}}
|
An example showing how to use the template in a list:
Code | Result |
---|---|
* A list item
* Another list item
** A subitem
** Learning: {{Shortcut compact|WP:EIW#Learn}}
*** A subsubitem about learning
*** Another subsubitem
|
|
Anchors
editUnlike {{Shortcut}}, this template does not place anchors automatically at its location. To enable displayed shortcuts to link to positions other than section heading names, use the {{Anchor}} template alongside this template.
Adding an anchor automatically tends not to work correctly when the displayed shortcut itself contains a fragment identifier (an anchor name after a number sign character), since the anchor should only consist of the fragment identifier, but the template cannot parse out the fragment from the rest of the displayed shortcut string. Automatic anchor insertion works best for top-of-page shortcuts which do not normally display fragment identifiers, the kind that {{Shortcut}} is intended to display.
Displaying shortcuts with fragment identifiers saves a lot of work for a long page with many section-specific or list-item-specific shortcuts, since one shortcut page provides a redirect that can then link to any anchor on the target page via a fragment identifier.
Portability notes
editThis template uses HTML table code, which may create problems on non-Wikimedia Foundation wikis that are not running HTML Tidy. The template itself generally works when a page transcludes it, but may cause problems if you use it inside another template that uses parser functions. See:
- Wikipedia:WikiProject Transwiki#Special templates - an explanation of the problem.
- Wikipedia:WikiProject Transwiki/Template:Shortcut compact - a portable version of this template that uses wikitext table code. (Unfortunately, the portable version is not compatible with nested list sub-items.)
See also
edit- Wikipedia:Editor's index to Wikipedia - a page that uses this template extensively.
- Wikipedia:Shortcuts - notes about how they work.
- {{shortcut}} – The normal shortcut.
- {{policy shortcut}} – For shortcuts to sections of policy pages.
- {{template shortcut}} – Use this one to show the names of shortcuts/redirects to a template.