Skip to content
EnglishFrançais

Template

A template is a reusable layout that sets the structure of a page and its common elements, such as the header or navigation. It also provides the places, called areas, where editors add content. In Jahia, editors select one when they create a page. Every page built on the same layout shares the same framework.

Definition and how it works

A shared layout lets a large organization have many editors create pages without the site losing its consistency. The brand and structure are carried by the shared layout. The editorial team focuses on content. A layout change is made once, instead of being repeated page by page.

In Jahia, a template defines the layout of pages as well as content items displayed as a page in their own right (main resources, see Content Template). It can contain non-editable elements and areas where editors add and edit content items, each rendered by a view. These layouts are written by developers and shipped in a module, for example a template set, in JSP (Java’s web page technology) or, since Jahia 8.2, in JSX or TSX (the markup syntax used with React) within a JavaScript module.

Academy documentation: developer training on template sets

Related terms: Content Template · View · Area · Template Set · Content item

Resources that cover this term

Template vs content template: the differences

A template organizes the whole page. A view renders one content item. A content template is a special case, which gives a full page to a content item that is not a page.

Layout concepts in Jahia
ConceptWhat distinguishes it
Content TemplateIt displays as a full page a content item that is not a page in the site tree, such as an article or a job offer.
ViewA view is the code that turns a content item into HTML. It renders one item, not the page framework.
AreaAn area is a placeholder defined in the layout’s code, where editors add their content items.

Template in practice

A corporate site can run on a small number of layouts, for instance a home page, a section page and a free content page. Each one sets the header, navigation and footer. Each one also offers areas where editors build their page with the allowed components. Teams create hundreds of pages without ever touching the structure. In return, changing a shared layout affects every page that uses it, so list those pages first.

Frequently asked questions

Does changing a template change the text of every page that uses it?

Not the content entered on each page. A template can carry non-editable elements, such as a footer text, which do change on every page that uses it. Changing a layout alters the structure and rendering rules of every page concerned, but the texts and images entered in the areas stay the editors’ own. Separating layout from content is what makes it possible to redesign a layout without re-entering the site.

Who creates a new template?

Developers write templates and deploy them in a module. Editors choose from the available layouts when they create a page, then build their content in the areas provided. A need for a new layout is therefore raised with the technical team, which adds it to the site’s template set.