Magnolia 5.7 reached extended end of life on May 31, 2022. Support for this branch is limited, see End-of-life policy. Please note that to cover the extra maintenance effort, this EEoL period is a paid extension in the life of the branch. Customers who opt for the extended maintenance will need a new license key to run future versions of Magnolia 5.7. If you have any questions or to subscribe to the extended maintenance, please get in touch with your local contact at Magnolia.
Light developers can use the create-page
command in the Magnolia CLI to create page templates.
Pages are based on page templates. A page definition knows which script should be used to render a page. It may also define areas. You can configure a template in a YAML file or a JCR node.
Page template properties
You can use common template properties and the following properties in a page definition:
renderType: freemarker templateScript: /my-module/templates/pages/home.ftl dialog: my-module:pages/homePageProperties # areas: visible: true class: com.example.templates.CustomTemplateDefinition modelClass: com.example.templates.HomePageModel
Node name | Value |
---|---|
templates | |
pages | |
home | |
areas | |
<area definitions> | |
class | com.example.templates.CustomTemplateDefinition |
dialog | my-module:pages/homePageProperties |
modelClass | com.example.templates.HomePageModel |
renderType | freemarker |
templateScript | /my-module/templates/pages/home.ftl |
visible | true |
Properties specific to page template definition:
| optional , default is
When |
type | optional, default is Assigns a type to the template. Types control template availability in the page hierarchy. For example type This property is different from the |
subtype | optional Assigns a subtype to the template. You can use subtypes to aggregate content. For example, aggregate all content pages of subtype |
autoPopulateFromRequest | optional, default is The population of request parameters is typically enabled globally in |
areas | optional |
Location of page definitions
Put your page definitions here:
- YAML file:
$magnolia.resources.dir/<module-name>/templates/pages
- JCR node:
/modules/<module-name>/templates/pages
Page subtypes
The optional subtype
property is useful for aggregating related page templates. For example, you could use this property to aggregate the latest news articles and then create a component that displays a list of excerpts that point to the news pages.
There are no default values and you can use arbitrary values to categorize your templates in any way you like.
Adding page areas
Page area definitions are added in the areas
node of a page template.
How to configure area definitions is covered in Area definition.
This example configuration adds two areas to a page template.
areas: area-1: # area-1 configuration area-2: #area-2 configuration
Node name | Value |
---|---|
<page template name> | |
areas | |
area-1 | <area-1 configuration> |
area-2 | <area-2 configuration> |