Wiki source code of Page Templates
Last modified by superadmin on 2026/10/14 18:26
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | A Page Template is declared from the [[Administration Application>>doc:extensions:Extension.Administration Application]], in its "Page Templates" administration section. [[Page Templates (for User)>>doc:documentation.xs.user.base.page.create.create-page-template.page-templates.WebHome]] explains what a template and a template provider are; this topic covers what you decide when you set one up. | ||
| 2 | |||
| 3 | [[Create a Page Template>>doc:documentation.xs.admin.page-templates.create-page-template.WebHome]] walks through the two pages you create, the template itself and the provider that offers it, and [[Template Provider Fields>>doc:documentation.xs.admin.page-templates.template-provider-fields.WebHome]] describes every field of the provider form. [[Use a Page Hierarchy as a Template>>doc:documentation.xs.admin.page-templates.page-hierarchy-template.WebHome]] covers the template that is a whole branch of the wiki. | ||
| 4 | |||
| 5 | Two of the provider's fields name locations: one where the template is offered, one where it is allowed to create pages. A location always means that page **and everything nested under it**. Restricting is how you propose the right kind of content in the right place: an expense report template offered everywhere is noise on a project page, while the same template offered only under "Expense Reports" is the obvious thing to create there. | ||
| 6 | |||
| 7 | Creating a page from a location that matches a template's creation restriction, exactly or as one of its descendants, moves that template to the top of the "Type" list and pre-selects it, so your users start from the structured page you intended rather than from a blank one. When several templates match, all of them are moved up and sorted by how specific the matching restriction is, the most specific first. | ||
| 8 | |||
| 9 | The same offer is made when a reader follows a broken link. The link opens the creation wizard with the title and the location already filled in from the link, and the templates available at that location are listed there too. | ||
| 10 | |||
| 11 | {{image reference="broken-link-template-offer.png" size="extra" alt="The creation wizard opened from a broken link, with the title Q1 Review and the location Projects / Roadmap / Q1 Review already filled in, and Project Brief pre-selected in the Templates group"/}} | ||
| 12 | |||
| 13 | {{version since="17.10.2"}} | ||
| 14 | A template may itself [[require a right>>doc:xwiki:documentation.xs.admin.rights.required-rights.WebHome]], and every page created from it then requires that right as well. A user who does not have it is not offered the template at all. A user who has it where the template is selected but not where the page is being created is shown an error instead of a new page, because the page could not be saved there. | ||
| 15 | {{/version}} |