Help:Beginner's guide to transclusion
What is transclusion?
"Transclusion" is the way we get text from the Page namespace to the main namespace. The Page namespace is where text is meant to be proofread. The main namespace is where text is meant to be read.
Transclusion copies the text across whenever anyone wants to read the page in the main namespace. It is still linked to the Page namespace. So any changes made to the text in the Page namespace will be seen in main namespace as well.
When to transclude
In an ideal scenario, all of the pages have been validated (green page status), first. Then, the text is transcluded, in as good a condition as possible.
In practice, this isn't always feasible. It can help with the proofreading to see a "preview" of what the final version will look like in the main namespace, especially if there are features that cross page boundaries or link to other sections. Some works – especially non-fiction works with chapters on separate topics – can have it be useful and feasible to transclude just a chapter at a time. And sometimes there just won't be appetite for a full validation of all pages for long, obscure works. That said, please ensure that text is at least presentable if it is being transcluded in the main space, even if it isn't perfect.
You should apply {{Incomplete}} as an invitation to others on works that are only partially transcluded.
Simple transclusion
To start transclusion:
- Start a new page on which you want the final version of the text to appear.
- Edit this page.
- Add just the transclusion code (as shown below).
- Save the page.
The code you need to use depends on how many pages you want to transclude to one page.
| Number of pages | Code to use |
|---|---|
| One | <pages index="filename" include="X" header="1" /> |
| Two or more | <pages index="filename" from="X" to="X" header="1" /> |
The red text needs to be changed to the details for your work and the pages you want to transclude:
- The filename is the name used for the Index page and the page scan file.
- The X's are the page numbers in the scan that you want to transclude. These are the page numbers from the scan (the numbers in the pagenames in the Page namespace) not the page numbers printed on the pages.
For example: If you were transcluding a chapter from a PDF or DJVU based Index, e.g. Index:My example book.djvu which covers pages 20 to 35 of the scan (i.e. pages Page:My example book.djvu/20, Page:My example book.djvu/21, ... Page:My example book.djvu/35). The code would be:
<pages index="My example book.djvu" from="20" to="35" header="1" />.
For example: If you were transcluding a chapter from an image based Index, e.g. Index:My example book, which covers pages 20 to 35 of the scan (i.e. pages Page:My example 20.jpg, Page:My example book 21.jpeg, ... Page:My example book 35.png). The code would be:
<pages index="My example book" from="My example 20.jpg" to="My example book 35.png" header="1" />.
Manual header
The simple transclusion uses a "magic header" that takes information from the Index page to create the header seen at the top of the page. If there is a problem with this header or you want more control, you may need to add a manual header instead.
To add a manual header:
- Start a new page at which you want the final version of the text to appear.
- Edit this page.
- Add the header code (as shown below).
- Fill in any parts of the header that you want filled in.
- Add the transclusion code (as shown below).
- Save.
The manual header code that needs to be added above the transclusion code is:
{{header
| title =
| author =
| translator =
| section =
| previous =
| next =
| year =
| portal =
| notes =
}}
The title and author parts need to be filled in. See {{header}} for more information.
The transclusion code is the same as with the simple transclusion except the "header" attribute should be excluded. (This is the part of the code that creates the "magic header".) Example code is shown below:
| Number of pages | Code to use |
|---|---|
| One | <pages index="filename" include="X" /> |
| Two or more | <pages index="filename" from="X" to="X" /> |
Advanced features
There are more things that can be done with transclusion. You can exclude or skip pages. You can also just transclude part of a page instead of the whole thing. For information on this and more, see Help:Transclusion.
Category:Beginner's guide#Transclusion