Template:TOC US states
Basic usage
[edit]There are various optional parameters:
{{TOC US states|before=|DC=|PR=|UST=|after=|seealso=|refs=|extlinks=}}
before=links to be listed at the beginning
DC=y
PR=y
UST=y
after=links to be listed at the end
seealso=y
refs=y
extlinks=y
Using DC
, PR
and/or UST
causes "District of Columbia", "Puerto Rico" and/or "US Territories" to be inserted in the correct alphabetic position within the list of states; these three non-states are omitted by default. These can also be spelled out, e.g. |Puerto Rico=y
. This feature is compatible with the other handling below (e.g. |DC=Washington, D.C.
with change the displayed output).
For before
and after
, a wikified list of one or more section headings is supplied as an argument, and those headings are inserted, either preceding the list of states (in the case of "before"
) or following it (in the cast of "after"
).
If seealso=y
, refs=y
, and/or extlinks=y
are present, links to a "See also", "References", and/or "External links" sections are included at the end.
The before
and after
lists contain one or more sequences of wikified section names, combined with '*' unordered list formatting. For example:
| after = [[#Footnotes|Footnotes]] * [[#Further reading|Further reading]]
Review other uses of this template for additional examples of how it can be used.
Modifying the linking behavior
[edit]For all of the purposes below, the fully spelled-out codes |District of Columbia=
, |Puerto Rico=
and |US Territoris=
must be used for those three cases, not the short versions DC
, PR
and UST
.
Removing a state
[edit]To remove a particular state from the table of contents, use |State=
, where State
is either the name of the state, or the two letter abbreviation for the state. This is most useful in articles covering specific regions of the US, or time periods before certain states had formed. For example,
| Kansas = | Alabama =
or
| KS = | AL =
would remove Kansas and Alabama from the table of contents.
Unlinking a state
[edit]In an article where a section about a state is simply missing (e.g. due to lack of data), it is more useful to replace a state's link with unlinked text, than to omit it:
| KS = Kansas | AL = Alabama
or
| Kansas = Kansas | Kansas = Alabama
Replacing a link
[edit]To change a state's link, use #-link wikimarkup:
| ND = [[#North and South Dakota|North and South Dakota]] | SD =
or
| North Dakota = [[#North and South Dakota|North and South Dakota]] | South Dakota =
This feature can also be used to link to sections in other articles, e.g. when a long list has been split into two pages.