Template:cat-if-entry

Definition from Wiktionary, the free dictionary
Jump to: navigation, search

{{#ifeq:{{NAMESPACE}}|{{{ns|}}}|{{#if:{{{2|}}}|[[Category:{{{1}}}|{{{2}}} {{PAGENAME}}]]|[[Category:{{{1}}}]]}}}}


The following documentation is located at Template:cat-if-entry/documentation. [edit]


Usage[edit]

May be called from a template that adds entries to a category. It handles requirements that are common to many such templates:

  • It only adds the category if the current page is an entry. (For example, a beer-parlour demonstration of {{fr-noun}} shouldn't add the BP to Category:French nouns.)
    • Alternatively, an ns= parameter can be provided to specify the namespace that should be categorized instead — ns=Appendix, say — but if you need any sort of detailed control, this template isn't for you. (Try {{cat-and-sort}} instead.)
  • If a second parameter is provided and non-blank, it is used as a sort-key. (Though the current entry-name is appended, for some added determinism.)
  • If a second parameter is absent or blank, then no sort-key is specified. This allows {{DEFAULTSORT}} to work properly.