Pages templates

Contents

Reuse the same page across multiple content items.

Introduction

portal:page-template is a built-in content type in Enonic XP, and similar to pages, they are only available in the context of a site.

Page templates may act as a base setup when creating new pages, but a more powerful application is to let editors control the presentation/page setup of other structured content types like Articles.

Usage

Editors work with, edit and publish page templates like any other content. Naturally, the main focus on a page template is setting up a page.

Like for any other page, at least one page component must be available in order to actually create a page template.

In addition to creating the page itself, editors may flag which content types the page template applies to. By specifying Article as the supported content type, the page template will be reused for rendering of all articles in the site.

The idea is not that editors control the details of how the article itself is presented, but rather the surrounding compoents and layout of the page where the article is presented. Developers should provide specific components for rendering the actual article, and the editors may then place this component centrally within their page template.

A single Article may also be configured with a custom page, or it may be flagged to use a specific page template. If so, this will override the page template defined above.

Rendering

Page template rendering is built-in functionality when using the Enonic Framework.

If you are using a 3rd party front-end, you will have to ensure the same logic is also applied there.

Also, check out our Next.js integration, where page templates are supported out-of-the-box.

Contents

Contents