Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fix by script - Avoid cross space links to DOCS56

...

The availability node in a site definition allows you to make templates available per site. This means, an editor working on site X can only choose templates that are available on site X. As a use case, a small campaign site may only have one available template whereas your main site has many templates.

Use the Site app to configure template availability by site.

Info

You need the Site module in order to create a site definition. The Site module is not always included, such as when you create your own bundle based on the empty webapp. Add a dependency to the Site module in your webapp pom file. The Site module provides the same availability definitions that were previously in the Standard Templating Kit module.

...

  • Community Edition and Enterprise Edition Standard:
    • /modules/<my-module>/config/<site-definition>/templates/availability when you want to store the site definition in your own module.
    • /modules/site/config/site/templates/availability when you want to store the site definition in the Site module.
  • Enterprise Edition Pro:
    • /modules/multisite/config/sites/<site-definition>/templates/availability when you have multiple sites and use the Multisite module.

Availability by role

The roles node in a site definition allows you to make templates available to users who have a specific role. The roles themselves are managed in the Security app. Reference them by name from the site definition.

Use the Site app to configure template availability by role.

...

roles

optional

<role name>

optional

The property name is arbitrary but the value must match a valid role as configured in the Security app.

Availability by type

The optional type property in a page definition allows you to make templates available per page type. Common page types are home, section and article. Types allow you to control where in the page tree a template can be used. If a template type is not allowed in a given place in the tree, it will not be available to editors.

...

Example: Configuring a TemplateAvailability class in the Site app.

Advanced Tables - Table Plus
heading0
multiplefalse
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node nameValue

Mgnl n
templates


Mgnl n
availability


Mgnl p
class

 com.example.myModule.site.CustomTemplateAvailability

...

Info

Multiexcerpt include
MultiExcerptNamecomponent-template-availability
PageWithExcerptDOCS56:_CLI_PromotionBoxes

The availability of a component is defined per area in an Area definition (and an area definition is always part of page template definition).

...

In this example component textImage can be used by any editor, but only users assigned the superuser role in the Security app can create a HTML component. See Roles for more.

Localtab Group
Localtab
activetrue
titleYAML file (fragment)
Code Block
languagejs
areas:
  myArea:
    availableComponents:
      textImage: 
        id: my-module:components/textImage
      html: 
        id: my-module:components/HTML
        roles:
          - superuser
        # could also be written as
        # roles: [superuser]
Localtab
titleJCR node
Advanced Tables - Table Plus
heading0
multiplefalse
enableHeadingAttributesfalse
enableSortingfalse
classm5-configuration-tree
enableHighlightingfalse
Node nameValue

Mgnl n
article


Mgnl n
areas


Mgnl n
myArea


Mgnl n
availableComponents


Mgnl n
textImage


Mgnl p
id

my-module:components/textImage

Mgnl n
html


Mgnl n
roles


Mgnl p
superuser

superuser

Mgnl p
id

my-module:components/HTML

...

permissions

optional

Required parent item that contains the action restrictions.

<write|move|delete|personalize>

optional

Action to which the restriction applies. (personalize is available only in Magnolia EE Pro)

roles

required

Note that roles must be added as list in the YAML file. (See YAML-Lists).

<roleName>

required

Identifies the role. The name of the attribute is arbitrary but the value must match an existing role