Skip to Content
Including pagesInclude control

Include control

Three tags control which parts of a page are used when it’s included, and which parts show on the page itself. They’re most useful on template pages — documentation that shouldn’t be included, markup that should only be included.

The three tags

<noinclude>…</noinclude> shown on the page itself; DROPPED when included <includeonly>…</includeonly> hidden on the page itself; included normally <onlyinclude>…</onlyinclude> if present, ONLY these fragments are included

The semantics in one table:

Content is inside…On the page itselfWhen included
(no tag)shownincluded — unless an <onlyinclude> exists anywhere on the page
<noinclude>showndropped
<includeonly>hiddenincluded
<onlyinclude>shownincluded — and everything outside is dropped

The typical template page

<includeonly><div class="notice">{{{1}}}</div></includeonly><noinclude> This template renders a notice banner. Usage: &#123;&#123;Notice|Your message&#125;&#125; </noinclude>

Viewing the template page shows the documentation; including it produces only the banner. (The &#123; entities show a literal {{…}} in the usage line — see Including pages.)

<onlyinclude> is the inverted tool: instead of marking what to hide, it marks what to share. If a page has any <onlyinclude> block, including that page pulls only those blocks — handy for reusing one section of a normal article (a shared intro, a stats box) without restructuring the article itself. Multiple <onlyinclude> blocks are all included, joined in order.

Details that matter

  • Tags don’t nest inside themselves, and each needs its closing tag — an unclosed <includeonly> won’t hide anything.
  • The editor’s preview shows the page view, never the included result: on a template page, preview hides <includeonly> content and shows <noinclude> content. To see the included result, preview an edit on a page that includes it.
  • Include control applies wherever a page is included from — Template namespace or a regular page via the fallback alike.
HonoWiki (Wiki engine) guide · Content CC BY-SA 4.0