قالب:Category link if exists/doc
| هذه صفحة توثيق فرعية لـ قالب:Category link if exists. تتضمن معلومات الاستعمال، التصنيفات وأي محتوى آخر ليس من محتويات الأصل لصفحة القالب. |
| This template is used on many pages, so changes to it will be widely noticed. Please test any changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Please consider discussing changes on the talk page قبل تنفيذهم. |
| Due to a server limit of 500 "expensive parser function" calls (e.g. #ifexist:, PAGESIZE:, and PAGESINCATEGORY:), this template will only work properly if the page using it has not already exceeded the limit. When the limit is exceeded, the page using this template or module is categorised in Category:Pages with too many expensive parser function calls. (further information) |
| Uses Lua: |
This is a simple helper template, to be used in other templates. It displays a link to a category if that category exists; otherwise it just displays greyed-out plaintext.
Optional display text may be added as a second parameter.
Usage
{{Category link if exists|CategoryName|OptionalDisplayText}}
- Simple usage
{{Category link if exists|CategoryName}}- Examples:
{{Category link if exists|A non-existent category}}→ A non-existent category{{Category link if exists|United States}}→ United States
- With optional display text
{{Category link if exists|CategoryName|DisplayText}}- Examples:
{{Category link if exists|A non-existent category|Foo}}→ A non-existent category{{Category link if exists|United States|USA}}→ United States
|hide_display=suppresses any output if the category does not exist-
{{Category link if exists|A non-existent category|hide_display=1}}→ A non-existent category{{Category link if exists|United States|USA|hide_display=1}}→ United States
See also
- Template:Category see also if exists
- Template:Category if exists – conditionally adds a parent category
- Template:Cat in use — allows checking of whether category is populated
- Template:Link if exists