Template:Conditional heading/doc

This template is designed to create conditional headers for transcludable pages where the heading level may be different on the transcluding and transcluded page. The typical usage is for a project or talk subpage which may benefit from subheadings and a table of contents, but where the transcluding page should generate a section heading at a different level.

Usage
1=

⟶ an H2 heading at the subpage, H3 elsewhere

⟶ H2 at the subpage, H4 elsewhere

⟶ same as above

Usage note: this template must be placed flush left on a new line by itself, just as for section headings. Placing it mid-line will simply generate plain-text with equal signs, and not be interpreted as a heading (just as for section headings).

Parameters
There are four parameters, one required, and three optional:


 * 1 section heading text (required, no default; alias header )
 * 2 basepage; along with baselevel, defines the section heading level (optional; alias basepage )
 * 3 is the level number of the heading on the base page: valid values are 0 through 6. (optional; alias: baselevel; default is : the equivalent of a  . 1 is equivalent to page title.)
 * 4 is the level number of the heading on the transcluding page: valid values are 0 through 6. (optional; alias: otherlevel; default is one more than the value of baselevel, or  if there isn't one.

Parameter notes: the level numbers in optional parameters 3 and 4 are as defined at Help:Wikitext. Normal values are therefore from 1 to 6 (although '1' is not normally used, so effectively 2 to 6). The special value of  means to skip generating the section heading entirely.

If you leave off optional parameters 3 and 4, the template will create a level 2 heading on the basepage, and a level 3 heading on the transcluding page.

It's best not to mix positional parameters with named aliases, use all positional, or all named.

Examples
It's in the nature of this template that examples displayed on one page cannot demonstrate the full feature set, because the whole point is that the headings appear differently on transcluding pages. These examples are a starter set, showing how they would appear on a single page.