Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Help:Template
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===<span id="Noinclude, includeonly, and onlyinclude"></span>Inclusion control: noinclude, includeonly, and onlyinclude=== {{shortcut|WP:NOINCLUDE|WP:INCLUDEONLY|WP:ONLYINCLUDE}} By default, when a page calls a template, MediaWiki includes the expansion of the entire template in the calling page. However, it is possible to modify that behavior, using tags that specify which parts of the template code are to be included. This makes it possible for the template to contain information only for display when the template page itself is displayed, such as the template's [[Wikipedia:Template documentation|documentation]], or [[WP:CAT#T|categories]]. It is also possible to have parts of the template be included in calling pages, but {{em|not}} be displayed when the template page itself is displayed and not be processed when the template page itself is saved (e.g., categories to be applied to calling pages which do not apply to the template). The tags are as follows: * {{xtag|noinclude|p}} β The text between the tags is {{em|not}} included when the template is called, but {{em|is}} processed when the template itself is displayed or saved; a common use is for [[WP:Template documentation|documentation in templates]]. * {{xtag|onlyinclude|p}} β Nothing on the page {{em|except}} what appears between the tags is included when the template is called. * {{xtag|includeonly|p}} β The text between the tags {{em|is}} included when the template is called, but is {{em|not}} processed when the template is displayed or saved. {| class="wikitable" style="text-align: center;" ! Wikitext ! What is rendered {{em|here}} (template page) ! What is included {{em|there}} (calling page) |- |{{tag|noinclude|content= {{bxt|text1}} }} {{mxtn|text2}} |{{bxt|text1}} {{mxtn|text2}} |{{mxtn|text2}} |- |{{tag|onlyinclude|content= {{bxt|text1}} }} {{mxtn|text2}} |{{bxt|text1}} {{mxtn|text2}} |{{bxt|text1}} |- |{{tag|includeonly|content= {{bxt|text1}} }} {{mxtn|text2}} |{{mxtn|text2}} |{{bxt|text1}} {{mxtn|text2}} |- |{{tag|onlyinclude|content={{tag|includeonly|content= {{bxt|text1}} }} }} {{mxtn|text2}} |{{mxtn|text2}} |{{bxt|text1}} |} Perhaps the most common issue with the use of these blocks is unwanted spaces or lines. It is important to remember that the effect of these tags begins immediately before the first angle bracket, not on the previous line or at the previous visible character; similarly the effect ends immediately after the last angle bracket, not on the next line or with the next visible character. For example: :{{mxt|<nowiki>}}<includeonly></nowiki>}} :{{!mxt|<nowiki>}}</nowiki><br /><nowiki></includeonly></nowiki>}} These tags can be nested inside each other, though (for a given page) this is really meaningful only for the {{tag|onlyinclude|o}} tag; nesting {{tag|includeonly|o}} and {{tag|noinclude|o}} tags is fairly pointless. Be careful to properly nest the tags, however. Constructions like {{tag|onlyinclude|o}}abc{{tag|includeonly|o}}def{{tag|onlyinclude|c}}ghi{{tag|includeonly|c}} will {{em|not}} work as expected. Use the "first opened, last closed" rule that is standard for HTML/XML.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)