Blame
|
1 | # Include |
||||||
| 2 | ||||||||
| 3 | [Include Documentation](/-/help/plugins#include) |
|||||||
| 4 | ||||||||
| 5 | The `{{include}}` embedding pulls another page, or a single section of it, into |
|||||||
| 6 | the current page. The examples below all include |
|||||||
| 7 | [[the sample page|Examples/Include/Sample Page]]. |
|||||||
| 8 | ||||||||
| 9 | ## The whole page |
|||||||
| 10 | ||||||||
| 11 | ``` |
|||||||
| 12 | {{include|src=/Examples/Include/Sample Page}} |
|||||||
| 13 | ``` |
|||||||
| 14 | ||||||||
| 15 | {{include|src=/Examples/Include/Sample Page}} |
|||||||
| 16 | ||||||||
| 17 | ## A single section |
|||||||
| 18 | ||||||||
| 19 | `section` is the heading anchor slug (lower case, spaces as dashes), matched |
|||||||
| 20 | independently of the heading level. `children=true` (the default) pulls in the |
|||||||
| 21 | subsections too, so this also brings along *Sea Otters*. |
|||||||
| 22 | ||||||||
| 23 | ``` |
|||||||
| 24 | {{include|src=/Examples/Include/Sample Page|section=otters}} |
|||||||
| 25 | ``` |
|||||||
| 26 | ||||||||
| 27 | {{include|src=/Examples/Include/Sample Page|section=otters}} |
|||||||
| 28 | ||||||||
| 29 | ## A section, without its subsections or heading |
|||||||
| 30 | ||||||||
| 31 | `children=false` stops at the next subheading and `heading=false` drops the |
|||||||
| 32 | section's own heading line, so this includes only the paragraph directly under |
|||||||
| 33 | *Otters*. |
|||||||
| 34 | ||||||||
| 35 | ``` |
|||||||
| 36 | {{include|src=/Examples/Include/Sample Page|section=otters|children=false|heading=false}} |
|||||||
| 37 | ``` |
|||||||
| 38 | ||||||||
| 39 | {{include|src=/Examples/Include/Sample Page|section=otters|children=false|heading=false}} |
|||||||
| 40 | ||||||||
| 41 | ## Things to watch out for |
|||||||
| 42 | ||||||||
| 43 | - **Use absolute paths inside included content.** Relative links and |
|||||||
| 44 | attachments (``) in the source resolve against the *including* |
|||||||
| 45 | page, not the source page, so they break. Write `/Source/Page/image.png` in |
|||||||
| 46 | anything meant to be included. That is why `src` above is written absolute as |
|||||||
| 47 | well, though relative `src` (resolved against this page) also works. |
|||||||
| 48 | - Headings from included content do not show up in this page's table of |
|||||||
| 49 | contents. |
|||||||
| 50 | - Do not combine a `{{DataTable}}` and an `{{include}}` on the same page; the |
|||||||
| 51 | page's own DataTable can be left uninitialised. Keep them on separate pages. |
|||||||
| 52 | - Includes nest at most 8 deep, and cycles (a page including itself, directly |
|||||||
| 53 | or through a chain) are detected and reported rather than expanded. |
|||||||
| 54 | ||||||||
| 55 | See the [Include documentation](/-/help/plugins#include) for the full option |
|||||||
| 56 | list. |
|||||||
