Documentation:MediaWiki Basics/Transclusion

From UBC Wiki

What is transclusion?

In computer science speak, transclusion is the inclusion of a document or part of a document into another document by reference. It is basically done by using the following format (squiggly brackets are important).

{{page title}}


What is it used for?

Transclusion allows for maximum flexibility in terms of how you mix and match content for various purposes. For example, creating subpages with small bits of content allows you to mix them up in different ways for different audiences. It allows the content to display on a page just as if you had authored it there. You can reference the same content on multiple pages and edit in on a single source page.


For example:

Source page:

Our source subpage page for MediaWiki Resources is here: http://wiki.ubc.ca/Documentation:MediaWiki_Basics/Resources

It is transcluded here: http://wiki.ubc.ca/Documentation:MediaWiki_Basics/Intro_Training

and here: http://wiki.ubc.ca/Documentation:MediaWiki_Basics/Elearning

If you are logged in to UBC wiki you can check the code on the editing screen for each of these pages.


Why is this important?

Once you get used to the idea of authoring many separate pages with bits of content, it gives you the maximum amount of flexibility for publishing different pages using the same content, saving time and centralizing editing to a single page!